webdav: make HEAD/GET on a dir fail

This commit is contained in:
Simon Ser 2020-01-17 11:32:13 +01:00
parent 326c4b9b6f
commit f4c21ca352
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -49,6 +49,10 @@ func (b *backend) HeadGet(w http.ResponseWriter, r *http.Request) error {
return err
}
if fi.IsDir() {
return &internal.HTTPError{Code: http.StatusMethodNotAllowed}
}
http.ServeContent(w, r, r.URL.Path, fi.ModTime(), f)
return nil
}