Skip to content

Commit bf96779

Browse files
committed
fix(serverHandler): use raw request path to generate sub item prefix
When visiting an aliased directory without tailing "/' in the URL, the sub item prefix generated is incorrect, because it uses the request path relative to the alias directory. It should use the path relative to root.
1 parent eb5b8b0 commit bf96779

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/serverHandler/responseData.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,11 @@ func (h *handler) mergeAlias(rawRequestPath string, item os.FileInfo, subItems [
182182
return subItems, errs
183183
}
184184

185-
func getSubItemPrefix(requestPath string, tailSlash bool) string {
185+
func getSubItemPrefix(rawRequestPath string, tailSlash bool) string {
186186
if tailSlash {
187187
return "./"
188188
} else {
189-
return "./" + path.Base(requestPath) + "/"
189+
return "./" + path.Base(rawRequestPath) + "/"
190190
}
191191
}
192192

@@ -314,7 +314,7 @@ func (h *handler) getResponseData(r *http.Request) (data *responseData) {
314314
subItems = h.FilterItems(subItems)
315315
sortSubItems(subItems)
316316

317-
subItemPrefix := getSubItemPrefix(reqPath, tailSlash)
317+
subItemPrefix := getSubItemPrefix(rawReqPath, tailSlash)
318318

319319
canUpload := h.getCanUpload(item, rawReqPath, reqFsPath)
320320
canArchive := h.getCanArchive(subItems, rawReqPath, reqFsPath)

0 commit comments

Comments
 (0)