Skip to content

Conversation

@marcelotto
Copy link
Contributor

Yet another fix of an issue in URI.merge/2. The problem concerns merging against a base with non-hierarchical URI schemes without authority (like "urn:"). According to the RFC 3986 merging algorithm, when dealing with base URIs that have a scheme but no authority, the path should be directly resolved. The current behavior however prepends a leading slash, which is neither standards-compliant nor useful in practice.

Example:

URI.merge("ex:", "test") |> to_string()
# Current: "ex:/test"  (incorrect)
# Expected: "ex:test"  (correct)

This should be the last fix in the series of corrections to the URI.merge/2 algorithm, as this makes the last failing test related to URI merging of the W3C JSON-LD 1.1 test suite pass.

Additionally, this PR reorganizes the grown URI.merge/2 tests into a describe block for better structure and readability.

@marcelotto marcelotto changed the title Fix uri merge handling of authorityless base Fix URI.merge/2 handling of authorityless base Mar 24, 2025
@josevalim josevalim merged commit b096b50 into elixir-lang:main Mar 24, 2025
10 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants