Repository navigation
Report an error instead of crashing on a bad --path - #705
Open
wanjinhao1 wants to merge 1 commit into
Open
wanjinhao1 wants to merge 1 commit into
wanjinhao1 wants to merge 1 commit into
Conversation
Signed-off-by: wanjinhao1 <394959433@qq.com>
wanjinhao1
force-pushed
the
agent/fix-704-bad-path-error
branch
from
November 17, 2026 16:09
15fb04b to
3e396a3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #704
Problem
preview:generate-all --path=<path>crashes with an unhandled exception instead of printing an error, in two cases:--path=/aliceor--path=/alice/files_trashbin):getRelativePath()returnsnull(it does not throw),nullis passed to$userFolder->get()and ends in aTypeError.--path=/alice/files/nope):$userFolder->get()throwsNotFoundException, but the call sits outside thetry/catch (NotFoundException)block, so the existing "Path not found" message is never printed.Changes
In
generatePathPreviews()(lib/Command/Generate.php):getRelativePath()fornulland printPath is outside of user's files folder: <path>before anything can passnulltoget().$userFolder->get($relativePath)call inside thetry/catch (NotFoundException)block so a missing path printsPath not found: <path>instead of crashing, and the loop over the remaining--pathvalues continues.Testing
No PHP toolchain was available in this environment, so
php -land the unit suite could not be run locally. The change is a control-flow reorder of existing statements with no new dependencies; both cases from the issue report now take the early-return path with a message. Would appreciate a CI run.This contribution was prepared with AI assistance and was reviewed by the contributor (@wanjinhao1).