Skip to content

fix(generate-all): report invalid --path values instead of crashing - #703

Open
horacioespinosa wants to merge 1 commit into
nextcloud:mainfrom
horacioespinosa:fix/generate-all-path-outside-user
Open

horacioespinosa wants to merge 1 commit into
nextcloud:mainfrom
horacioespinosa:fix/generate-all-path-outside-user

Conversation

@horacioespinosa

@horacioespinosa horacioespinosa commented Nov 17, 2026 •

Copy link
Copy Markdown

If you give preview:generate-all a wrong --path, the command crashes with an unhandled exception, and any --path values after it never get processed. It happens in two cases:

  • A path outside the user's files folder, like --path=/alice (the missing /files/ in PathHelper error when trying to generate for a specific folder #455), ends in a TypeError from PathHelper::normalizePath(). Folder::getRelativePath() returns null for it, and that goes straight into Folder::get().
  • A path that doesn't exist, like --path=/alice/files/nope, throws NotFoundException. get() sits outside the try that was meant to catch it, so the existing Path not found message is never printed.

With this change both cases print an error (Path /alice is not inside the files folder of user alice, Path not found: /alice/files/nope), the command goes on with the remaining --path values and exits with 1. Valid paths behave as before.

To unit test the command, the two \OC_Util::tearDownFS() / \OC_Util::setupFS() pairs move into a protected method, setupUserFileSystem(), that the test overrides. That part doesn't change behaviour.

Folder::getRelativePath() returns null for a path that is not inside the
user files folder, and Folder::get() throws for a missing path; neither
was handled, so the command ended in a TypeError or an uncaught
NotFoundException. Print an error, keep processing the other paths and
exit with a non-zero code.

Signed-off-by: Horacio Darinel Espinosa Barcelo <admin@cloudfrog.com.mx>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T16:11:44.406368Z 115aa48 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant