Commit 4dbd2a10 authored by Robert Stepanek's avatar Robert Stepanek Committed by Nigel Tao

webdav: Return HTTP 404 for PROPFIND/PROPPATCH requests on an inexistent

webdav.Dir resource.

Change-Id: If28dc1853cc3f393a53bf8f0e0f0bb87328c3d29
Reviewed-on: https://go-review.googlesource.com/10394Reviewed-by: 's avatarNigel Tao <nigeltao@golang.org>
parent 7ca853dc
...@@ -468,7 +468,7 @@ func (h *Handler) handleUnlock(w http.ResponseWriter, r *http.Request) (status i ...@@ -468,7 +468,7 @@ func (h *Handler) handleUnlock(w http.ResponseWriter, r *http.Request) (status i
func (h *Handler) handlePropfind(w http.ResponseWriter, r *http.Request) (status int, err error) { func (h *Handler) handlePropfind(w http.ResponseWriter, r *http.Request) (status int, err error) {
fi, err := h.FileSystem.Stat(r.URL.Path) fi, err := h.FileSystem.Stat(r.URL.Path)
if err != nil { if err != nil {
if err == os.ErrNotExist { if os.IsNotExist(err) {
return http.StatusNotFound, err return http.StatusNotFound, err
} }
return http.StatusMethodNotAllowed, err return http.StatusMethodNotAllowed, err
...@@ -532,7 +532,7 @@ func (h *Handler) handleProppatch(w http.ResponseWriter, r *http.Request) (statu ...@@ -532,7 +532,7 @@ func (h *Handler) handleProppatch(w http.ResponseWriter, r *http.Request) (statu
defer release() defer release()
if _, err := h.FileSystem.Stat(r.URL.Path); err != nil { if _, err := h.FileSystem.Stat(r.URL.Path); err != nil {
if err == os.ErrNotExist { if os.IsNotExist(err) {
return http.StatusNotFound, err return http.StatusNotFound, err
} }
return http.StatusMethodNotAllowed, err return http.StatusMethodNotAllowed, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment