Repository navigation
curl request snippet does not send multipart form values that contain ; or start with @, <, or ( - #1077
Open
chuuminggg wants to merge 1 commit into
Open
curl request snippet does not send multipart form values that contain ; or start with @, <, or (#1077chuuminggg wants to merge 1 commit into
chuuminggg wants to merge 1 commit into
Conversation
Previously, the content of a part without a submitted file name was used as is in curl's -F option. curl truncates such a value at ; and gives a leading @, <, or ( a special meaning, so the command did not send the documented content. Such values are now enclosed in double quotes. Signed-off-by: chuuminggg <rorrxr@naver.com>
chuuminggg
force-pushed
the
n5-curl-form-string
branch
from
October 16, 2026 10:37
8fe2c30 to
8eab815
Compare
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.
For a part without a submitted file name, the curl request snippet puts the part's content directly into
-F 'name=content'. curl gives some characters in an-Fvalue a special meaning, so the command doesn't always send the documented content:{"description": "foo; bar"}-F 'metadata={"description": "foo; bar"}'{"description": "foo(truncated at;)@alice-F 'mention=@alice'aliceand fails (exit code 26)<b>bold</b>-F 'note=<b>bold</b>'b>bold</b>and fails (exit code 26)(optional)-F 'note=(optional)'multipart/mixedsubpart instead of sending the textA
;anywhere in the value is the most likely case in practice, as it's common in JSON or text parts.curl allows an
-Fvalue to be enclosed in double quotes. Within the quotes,\escapes"and\, and none of the characters above has a special meaning. This PR quotes the value only when it's needed: when it starts with@,<,(, or", or contains;. Other values are written as before, so existing snippets don't change. A;type=for the part's content type is still appended after the closing quote:I checked each of the new expected commands with curl 8.16.0 against a local server that echoes the request body, and each one sends the original content.
--form-stringwas another option, but it can't be combined with;type=, so the part's content type would be lost.I've based this on
4.0.x, as that's where #1058 changed the same method. The same problem exists in3.0.x.A submitted file name that contains
;or"(for example-F 'file=@a;b.png') has a similar problem. I've left it out to keep this change focused, but I'm happy to handle it as well.