Repository navigation
Give upload temp files a fixed-length name - #44
Merged
Merged
Conversation
Uploads were written to ".{filename}.{32 hex}.part" first, which adds 39
bytes to the name, so a valid name over ~216 bytes went past the 255-byte
filename limit and the upload failed with a server error.
Fixes #43
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ames # Conflicts: # tests/test_file_manager.py
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 #43
What changed
save_uploaded_file()writes to.upload-{uuid}.partinstead of.{filename}.{uuid}.part, so the temp name no longer grows with the upload's name. The rest (write to temp, then atomic replace; cleanup on failure) is unchanged.Testing
pytest: 227 passed, 4 skipped. New tests: a 224-byte UTF-8 name and a 254-character name upload, no temp file is left behind, an existing file is only replaced withoverwrite. The 254-character case skips on Windows, where the test's temp directory hits the 260-character path limit (not an app concern: the container is Linux).save_uploaded_file()with FastAPI/aiofiles stubbed: the original fails both long names withOSError: [Errno 36] File name too long; the fix uploads them with no temp files left.🤖 Generated with Claude Code