Skip to content

Commit

Permalink
Merge pull request #4771 from JammingBen/fix/dav-delete-via-id
Browse files Browse the repository at this point in the history
fix: dav delete via resource id
  • Loading branch information
butonic authored Jul 19, 2024
2 parents f9f1c8e + 4b55209 commit d42ea8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-dav-id-based-delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Deleting resources via their id

We fixed a bug where deleting resources by using their id via the `/dav/spaces/` endpoint would not work.

https://github.com/cs3org/reva/pull/4771
https://github.com/owncloud/ocis/issues/9619
7 changes: 5 additions & 2 deletions internal/http/services/owncloud/ocdav/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,11 @@ func (s *svc) handleSpacesDelete(w http.ResponseWriter, r *http.Request, spaceID

// do not allow deleting spaces via dav endpoint - use graph endpoint instead
// we get a relative reference coming from the space root
// so if the path is "empty" we a referencing the space
if ref.GetPath() == "." {
// so if the path is "empty" and no opaque id is present or the opaque id equals
// the space id, we are referencing the space
rid := ref.GetResourceId()
if ref.GetPath() == "." &&
(rid.GetOpaqueId() == "" || rid.GetOpaqueId() == rid.GetSpaceId()) {
return http.StatusMethodNotAllowed, errors.New("deleting spaces via dav is not allowed")
}

Expand Down

0 comments on commit d42ea8f

Please sign in to comment.