Repository navigation
tool: trim trailing URL separators in linear time - #23405
Closed
cla7aye15I4nd wants to merge 4 commits into
Closed
cla7aye15I4nd wants to merge 4 commits into
cla7aye15I4nd wants to merge 4 commits into
Conversation
vszakats
reviewed
Oct 15, 2026
cla7aye15I4nd
marked this pull request as ready for review
October 15, 2026 07:41
bagder
reviewed
Oct 15, 2026
bagder
approved these changes
Oct 15, 2026
There was a problem hiding this comment.
🟢 Approval recommended
The focused change preserves filename-selection behavior, includes regression coverage, and has no unresolved findings.
0 open findings
What changed in this PR
Makes command-line curl -O filename selection linear-time for URLs with long trailing separator runs while preserving existing behavior.
Changes:
- Trims trailing slashes and backslashes before locating the filename.
- Expands test 1639 to use 60,000 trailing slashes through a config file.
| File | Description |
|---|---|
| tests/data/test1639 | Exercises a long trailing-slash URL without a long command line. |
| src/tool_operhlp.c | Replaces repeated path searches with one suffix-trimming pass. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
With
curl -O, a URL ending in a long run of/or\makes filename selection rescan the remaining path after removing each separator. Trim the entire suffix in one pass, then search once for the final path component. Root paths still use the default filename, and mixed slash/backslash handling is retained.Existing test 1639 now supplies a URL with 60,000 trailing slashes through a test config file, keeping command lines short, and checks the downloaded file name and contents. Test 1644 continues to cover a path component followed by trailing slashes. Both tests pass in a debug CMake build. This is a command-line CPU-efficiency fix; the test covers the long-input behavior but does not assert a runtime threshold.