Skip to content

Commit aa0ced4

Browse files
authored
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.
1 parent ab747d9 commit aa0ced4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server/webdav/webdav.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ func (h *Handler) handleGetHeadPost(w http.ResponseWriter, r *http.Request) (sta
233233
return http.StatusNotFound, err
234234
}
235235
if fi.IsDir() {
236+
if r.Method == http.MethodHead {
237+
w.Header().Set("Content-Type", "httpd/unix-directory")
238+
w.Header().Set("Content-Length", "0")
239+
return http.StatusOK, nil
240+
}
236241
return http.StatusMethodNotAllowed, nil
237242
}
238243
// Let ServeContent determine the Content-Type header.

0 commit comments

Comments
 (0)