Skip to content

Commit 692c40e

Browse files
committedApr 27, 2022
handle invalid resourceID
1 parent 3e2e4f8 commit 692c40e

File tree

1 file changed

+9
-0
lines changed
  • internal/http/services/owncloud/ocdav

1 file changed

+9
-0
lines changed
 

‎internal/http/services/owncloud/ocdav/meta.go

+9
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ func (h *MetaHandler) Handler(s *svc) http.Handler {
5858
}
5959

6060
did := resourceid.OwnCloudResourceIDUnwrap(id)
61+
if did == nil {
62+
logger := appctx.GetLogger(r.Context())
63+
logger.Debug().Str("prop", net.PropOcMetaPathForUser).Msg("invalid resource id")
64+
w.WriteHeader(http.StatusBadRequest)
65+
m := fmt.Sprintf("Invalid resource id %v", id)
66+
b, err := errors.Marshal(http.StatusBadRequest, m, "")
67+
errors.HandleWebdavError(logger, w, b, err)
68+
return
69+
}
6170

6271
var head string
6372
head, r.URL.Path = router.ShiftPath(r.URL.Path)

0 commit comments

Comments
 (0)