Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dav delete via resource id #4771

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

JammingBen
Copy link

@JammingBen JammingBen commented Jul 19, 2024

Fixes an issue where deleting a resource via its id, using the /dav/spaces/{fileId} endpoint, wouldn't work.

The issue was happening because the code was checking for an empty path to prevent spaces from being deleted this way (because spaces have an empty path). When only providing a resource id however, the path will be empty for regular resources as well. For this reason we now additionally check for the resource's opaqueId. If the resource doesn't have such and the path is empty, we can assume that it's a space and prevent deletion via the dav endpoint.

fixes owncloud/ocis#9619

@JammingBen JammingBen self-assigned this Jul 19, 2024
@JammingBen JammingBen force-pushed the fix/dav-delete-via-id branch 2 times, most recently from dcb1326 to e165045 Compare July 19, 2024 05:47
@JammingBen JammingBen marked this pull request as ready for review July 19, 2024 06:15
@JammingBen JammingBen requested review from labkode, a team and glpatcern as code owners July 19, 2024 06:15
@JammingBen JammingBen requested a review from kobergj July 19, 2024 06:15
@JammingBen
Copy link
Author

@kobergj Pinging you specifically for a review because I saw that you touched the initial code a while ago :)

internal/http/services/owncloud/ocdav/delete.go Outdated Show resolved Hide resolved
Fixes an issue where deleting a resource via its id, using the `/dav/spaces/{fileId}` endpoint, wouldn't work.

The issue was happening because the code was checking for an empty path to prevent spaces from being deleted this way (because spaces have an empty path). When only providing a resource id however, the path will be empty for regular resources as well. For this reason we now additionally check for the resource's `opaqueId`. If the resource doesn't have such or it equals the space id, and the path is empty, then we can assume that it's a space and prevent deletion via the dav endpoint.
Copy link
Contributor

@kobergj kobergj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 👍

@butonic butonic merged commit d42ea8f into cs3org:edge Jul 19, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants