Skip to content

fix(files): only reuse the cached path-by-id when it is inside the requested path - #65760

Open
MarioPym wants to merge 2 commits into
nextcloud:masterfrom
MarioPym:fix/root-cached-path-in-requested-path
Open

MarioPym wants to merge 2 commits into
nextcloud:masterfrom
MarioPym:fix/root-cached-path-in-requested-path

Conversation

@MarioPym

Copy link
Copy Markdown
Contributor

Summary

The Favorites view fails with a 500 error ("Failed to get relative path") after the preview of a deleted favorite file was requested from the trash bin.

Root::getFirstNodeByIdInPath() reuses the cached path for a file id when it starts with the requested path. But /user/files_trashbin/files/x.txt also starts with /user/files, so a node from the trash bin is returned for the user's files and the REPORT request fails.

This checks that the cached path is actually inside the requested path, using PathHelper::getRelativePath() as getByIdInPath() already does when filtering its results.

How to test

  1. Upload an image and mark it as favorite
  2. Delete it
  3. Open "Deleted files" (the preview of the deleted file is requested)
  4. Open "Favorites": the REPORT /remote.php/dav/files/<user>/ request fails with 500 Failed to get relative path for /<user>/files_trashbin/files/<name>.d<timestamp>

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

…quested path

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Mario Alfonso Pym Mejía <pymm@hitss.com>
@MarioPym
MarioPym requested a review from a team as a code owner October 21, 2026 13:32
@MarioPym
MarioPym requested review from Altahrim, icewind1991, leftybournes and salmart-dev and removed request for a team October 21, 2026 13:32
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@MarioPym

Copy link
Copy Markdown
Contributor Author

Friendly ping for review when you have a moment. The branch is up to date with master and merges cleanly. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants