mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-19 04:06:18 +08:00
fix(webdav): Handle HEAD requests for directories with appropriate headers (#1015)
Implement handling of HEAD requests for directories by setting the correct Content-Type and Content-Length headers.
This commit is contained in:
@ -233,6 +233,11 @@ func (h *Handler) handleGetHeadPost(w http.ResponseWriter, r *http.Request) (sta
|
|||||||
return http.StatusNotFound, err
|
return http.StatusNotFound, err
|
||||||
}
|
}
|
||||||
if fi.IsDir() {
|
if fi.IsDir() {
|
||||||
|
if r.Method == http.MethodHead {
|
||||||
|
w.Header().Set("Content-Type", "httpd/unix-directory")
|
||||||
|
w.Header().Set("Content-Length", "0")
|
||||||
|
return http.StatusOK, nil
|
||||||
|
}
|
||||||
return http.StatusMethodNotAllowed, nil
|
return http.StatusMethodNotAllowed, nil
|
||||||
}
|
}
|
||||||
// Let ServeContent determine the Content-Type header.
|
// Let ServeContent determine the Content-Type header.
|
||||||
|
Reference in New Issue
Block a user