-
Notifications
You must be signed in to change notification settings - Fork 218
fix: handle missing filename in file upload to prevent panic #138
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
Conversation
Replace unwrap() calls with proper error handling when processing uploaded files. When no filename is provided, the server now logs a warning and continues processing instead of panicking. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
| println!("[Warning]: Invalid filename: {}", raw_filename); | ||
| continue; | ||
| } | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use if-let-else here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Use if-let-else pattern for both filename extraction and validation ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let Some(raw_filename) = headers.filename.clone() else {
println!("[Warning]: Skipping field with no filename");
continue;
};There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run cargo fmt for your code.
- Replace unwrap() calls with proper error handling when processing uploaded files - Use if-let pattern for filename validation as requested - When no filename is provided, server now logs warning and continues instead of panicking 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace unwrap() calls with proper error handling when processing uploaded files - Use if-let-else pattern for both filename extraction and validation - When no filename is provided, server now logs warning and continues instead of panicking 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace unwrap() calls with proper error handling when processing uploaded files - Use if-let-else pattern for both filename extraction and validation - When no filename is provided, server now logs warning and continues instead of panicking 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace unsafe unwrap() calls with safe if-let-else pattern - Add proper validation for missing and invalid filenames - Skip malformed uploads with warning messages instead of panicking - Use modern Rust idioms for cleaner error handling Addresses potential crashes when users upload files without proper filename headers or with invalid path names.
- Replace unsafe unwrap() calls with safe if-let-else pattern - Add proper validation for missing and invalid filenames - Skip malformed uploads with warning messages instead of panicking - Use modern Rust idioms for cleaner error handling Addresses potential crashes when users upload files without proper filename headers or with invalid path names.

Replace unwrap() calls with proper error handling when processing uploaded files.
When no filename is provided, the server now logs a warning and continues
processing instead of panicking.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com
2025-08-02-upload.txt