Skip to content

Commit

Permalink
handle invalid resourceID
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Apr 27, 2022
1 parent 3e2e4f8 commit 692c40e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/http/services/owncloud/ocdav/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ func (h *MetaHandler) Handler(s *svc) http.Handler {
}

did := resourceid.OwnCloudResourceIDUnwrap(id)
if did == nil {
logger := appctx.GetLogger(r.Context())
logger.Debug().Str("prop", net.PropOcMetaPathForUser).Msg("invalid resource id")
w.WriteHeader(http.StatusBadRequest)
m := fmt.Sprintf("Invalid resource id %v", id)
b, err := errors.Marshal(http.StatusBadRequest, m, "")
errors.HandleWebdavError(logger, w, b, err)
return
}

var head string
head, r.URL.Path = router.ShiftPath(r.URL.Path)
Expand Down

0 comments on commit 692c40e

Please sign in to comment.