Fix leading slash for abspath in joinpath (continuation of #62) - #71
Merged
Conversation
Signed-off-by: Peter Bräuer <pb866.git@gmail.com>
Add tests to add absolut path with and without trailing slash and absolut path with additional part to an empty uri path. Signed-off-by: Peter Bräuer <pb866.git@gmail.com>
Per RFC 3986 Section 3.3, a URI without an authority component cannot have a path beginning with "//" -- serializing such a URI is ambiguous (the path prefix would be re-parsed as an authority), breaking string/parse round-tripping. Throw an informative ArgumentError from joinpath in that case, and add regression tests covering "file:", "file://", empty-URI, and authority-present cases. Bump version to 1.6.3. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #71 +/- ##
==========================================
+ Coverage 84.49% 84.63% +0.14%
==========================================
Files 5 5
Lines 329 332 +3
==========================================
+ Hits 278 281 +3
Misses 51 51 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Continuation of #62 by @pb866 (the head branch there lives in an org-owned fork, which GitHub doesn't allow maintainer pushes to, so finishing it here — original commits/authorship preserved).
On top of #62's fix for the double leading slash (
joinpath(URI("http://test.com"), "/abs/path")now correctly giveshttp://test.com/abs/path), this:URI("file:")or an emptyURI()), a joined path beginning with//is unrepresentable per RFC 3986 §3.3 — serializing it would be re-parsed with the first path segment as the authority, breaking round-tripping.joinpathnow throws an informativeArgumentErrorin that case.file:,file://, empty-URI, and authority-present cases, including string round-trip checks. Notefile://(empty-but-present authority) serializes asfile:////server/share, which round-trips fine and remains allowed.Merging this will mark #62 as merged automatically (its head commit is in this branch's history).
🤖 Generated with Claude Code