curl: named globs in output file name for upload glob references#21407
curl: named globs in output file name for upload glob references#21407bagder wants to merge 1 commit into
Conversation
5a751c0 to
352ad26
Compare
This comment was marked as resolved.
This comment was marked as resolved.
352ad26 to
cdf04b4
Compare
cdf04b4 to
c23613f
Compare
There was a problem hiding this comment.
Pull request overview
Adds support in the curl tool for using named glob parts from --upload-file (upload-file globbing) when expanding --output filenames (via #<name>), similar to existing named URL glob support. This enables generating per-upload response filenames even when the URL itself is not globbed.
Changes:
- Extend
glob_match_url()to optionally resolve named#<...>references from a second glob set (upload-file glob). - Update output filename setup to consider upload-file glob usage in addition to URL glob usage.
- Add test coverage (test2014) and document the new capability in
--upload-fileand--outputdocs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/data/test2014 | New regression test verifying --output can reference a named glob from --upload-file. |
| tests/data/Makefile.am | Registers the new test case. |
| src/tool_urlglob.h | Updates glob_match_url() signature to accept a second glob pointer. |
| src/tool_urlglob.c | Implements lookup of named glob references in the second glob list. |
| src/tool_operate.c | Wires upload-file glob into output filename glob expansion. |
| docs/cmdline-opts/upload-file.md | Documents referencing named upload-file globs in --output. |
| docs/cmdline-opts/output.md | Documents referencing named upload-file globs in output templates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
88a1320 to
3704111
Compare
|
augment review |
🤖 Augment PR SummarySummary: This PR extends curl’s output filename glob substitution so that parts of a globbed upload filename can be referenced (via named globs) when using Changes:
Testing: Verified by new test 2014 (upload with glob; output name based on upload glob). 🤖 Was this summary useful? React with 👍 or 👎 |
Use parts of text from the upload filename field when that uses globbing
by giving it a name the same way we do it for URL globs. For example, if
you upload three files to a HTTP URL and want to save the corresponding
responses in separate files:
curl -T 'file{<num>1,2,3}' https://upload.example/ -o 'response-#<num>'
Verified by test 2014
Closes #21407
3704111 to
2e5263e
Compare
Use parts of text from the upload filename field when that uses globbing
by giving it a name the same way we do it for URL globs. For example, if
you upload three files to a HTTP URL and want to save the corresponding
responses in separate files:
curl -T 'file{<num>1,2,3}' https://upload.example/ -o 'response-#<num>'
Verified by test 2014
Closes curl#21407
Use parts of text from the upload filename field when that uses globbing
by giving it a name the same way we do it for URL globs. For example, if
you upload three files to a HTTP URL and want to save the corresponding
responses in separate files:
Verified by test 2014