Skip to content

fix(upload): do not panic on a missing path - #288

Open
ApexAiOfficial wants to merge 1 commit into
gotd:mainfrom
ApexAiOfficial:up/upload-missing-path
Open

ApexAiOfficial wants to merge 1 commit into
gotd:mainfrom
ApexAiOfficial:up/upload-missing-path

Conversation

@ApexAiOfficial

Copy link
Copy Markdown

The filepath.Walk callback evaluated info.IsDir() before checking the walk
error. For a path that does not exist Walk passes a nil FileInfo, so
tg upload ./missing.pdf panicked with a nil pointer dereference after
connecting. Check the error first (in a small tested walkFiles helper), and
stat the path before connecting so the failure is immediate.

🤖 Generated with Claude Code

The filepath.Walk callback evaluated info.IsDir() before checking the walk
error. For a path that does not exist Walk passes a nil FileInfo, so
`tg upload ./missing.pdf` panicked with a nil pointer dereference after
connecting. Check the error first (in a small tested walkFiles helper), and
stat the path before connecting so the failure is immediate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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