Repository navigation
fix(client): strip directory components from download filenames - #5788
Open
remote-controlled-man wants to merge 1 commit into
Open
remote-controlled-man wants to merge 1 commit into
remote-controlled-man wants to merge 1 commit into
Conversation
remote-controlled-man
requested review from
jianshen92
and
a balanced review from Copilot
and removed request for
a team
November 6, 2026 05:24
This branch has not been deployed
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.
What does this PR address?
Both HTTP clients fail to save a successful file response when its
Content-Dispositionfilename contains directories. For example,filename="subdir/nested/document.pdf"is passed directly toNamedTemporaryFile(suffix=...), which raisesFileNotFoundErrorinstead of returning the download.Keep only the filename's last component before creating the temporary file, handling both slash styles independently of the client OS. The temporary directory, randomized prefix, file bytes, and plain or absent filename behavior are preserved. This applies to synchronous and asynchronous downloads, including their shared task-result file response paths.
This follows the recipient guidance in RFC 6266 §4.3. #5533 fixed the analogous upload path in
FileSchema.decode; this change covers the separate HTTP client response paths.AI assistance was used for investigation, implementation, tests, and independent review.
Validation
FileNotFoundErrorbefore their respective fixes.filename*, and plain/absent filename controls.tests/e2e/bento_new_sdksuite: 9 passed.pre-commit run --all-files: passed; Buf hooks had no applicable files.git diff --check HEAD^ HEAD: passed.bentoml.SyncHTTPClientandbentoml.AsyncHTTPClient) downloaded matching bytes over a real local HTTP connection using the directory-containing response filename.make typestill refers to the removed typecheck hook; typechecking was disabled upstream in #4113. No passing typecheck or cross-platform matrix result is claimed.Before submitting