Repository navigation
Conversation
…a#572) Filenames containing characters outside the RFC 5987 attr-char set (e.g., parentheses, spaces, unicode) are now properly percent-encoded in the Content-Disposition header using the filename* parameter. Per RFC 2616 Section 2.2, parentheses are separators and must be encoded. Per RFC 5987 Section 3.2.1, attr-char only includes: ALPHA / DIGIT / "!" / "#" / "$" / "&" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" The fix: - Adds both filename="..." (for backwards compatibility) and filename*=utf-8''... (RFC 5987 encoded) when special chars are present - Normal filenames without special chars only use filename="..." - Per RFC 6266 Section 4.3, receivers should prefer filename* over filename This fixes compatibility with .NET servers that strictly validate Content-Disposition headers according to RFC 5987. Fixes form-data#572 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
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.
Summary
filename*parameterProblem
When uploading files with parentheses in the filename (e.g.,
test(1).txt), .NET 8 servers reject the request with "Failed to read the request form. Form section has invalid Content-Disposition value".Per RFC 2616 Section 2.2, parentheses are separators and should not appear unencoded in header parameter values. Per RFC 5987 Section 3.2.1, the
attr-charset only includes:Solution
When a filename contains characters outside the
attr-charset, the fix now generates:Per RFC 6266 Section 4.3, receivers should prefer
filename*overfilename, but including both ensures maximum compatibility.For filenames without special characters, the output remains unchanged:
Test Plan
Compatibility
filenamealways includedFixes #572