Skip to content

Commit 4f9ab24

Browse files
committed
fix(serverHandler): output status 404 for non-exist item when --empty-root
1 parent ce62fba commit 4f9ab24

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/serverHandler/responseData.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ func (h *handler) getResponseData(r *http.Request) (data *responseData) {
348348
status = http.StatusInternalServerError
349349
}
350350

351+
if h.emptyRoot && status == http.StatusOK && r.RequestURI != "/" {
352+
status = http.StatusNotFound
353+
}
354+
351355
subInfos = h.FilterItems(subInfos)
352356

353357
subItems := getSubItems(subInfos)

0 commit comments

Comments
 (0)