瀏覽代碼

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

Change-Id: If28dc1853cc3f393a53bf8f0e0f0bb87328c3d29
Reviewed-on: https://go-review.googlesource.com/10394
Reviewed-by: Nigel Tao <nigeltao@golang.org>

Robert Stepanek 10 年之前
父節點
當前提交
4dbd2a1007
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      webdav/webdav.go

+ 2 - 2
webdav/webdav.go

@@ -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) {
 	fi, err := h.FileSystem.Stat(r.URL.Path)
 	if err != nil {
-		if err == os.ErrNotExist {
+		if os.IsNotExist(err) {
 			return http.StatusNotFound, err
 		}
 		return http.StatusMethodNotAllowed, err
@@ -532,7 +532,7 @@ func (h *Handler) handleProppatch(w http.ResponseWriter, r *http.Request) (statu
 	defer release()
 
 	if _, err := h.FileSystem.Stat(r.URL.Path); err != nil {
-		if err == os.ErrNotExist {
+		if os.IsNotExist(err) {
 			return http.StatusNotFound, err
 		}
 		return http.StatusMethodNotAllowed, err