Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ require (
go.yaml.in/yaml/v3 v3.0.5 // indirect
)

go 1.25.0
go 1.26.0
17 changes: 11 additions & 6 deletions normalizer_canonical_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,22 @@ func TestNormalizer_Canonicalization(t *testing.T) {
refPath: "https://user:pw@EXAMPLE.com:443/other.json",
expected: "https://user:pw@example.com/other.json",
},
{
name: "degenerate authority, port kept",
rule: "url.Parse reads the host as \":a\" on port 443, and dropping the port would leave a URI that no longer parses",
// Since go1.26, url.Parse rejects a colon outside a bracketed IPv6 host on an http or https URL
// (GODEBUG urlstrictcolons=1, the default from a go.mod declaring go 1.26 or later). Both $refs below
// used to parse - the first as the host ":a" on port 443, the second as "0:443" on port 443 - and both
// now fail. normalizeURI logs a warning, repairs the $ref to the empty URI and resolves it against the
// base, so the base itself comes back.
{
name: "degenerate authority, stray colon",
rule: "a colon in the host is rejected, and an unresolvable $ref falls back to the base",
refPath: "https://:a:443/other.json",
expected: "https://:a:443/other.json",
expected: base,
},
{
name: "degenerate authority, port twice",
rule: "the host \"0:443\" spells a default port of its own, so removal repeats",
rule: "same for a host spelling a port of its own",
refPath: "https://0:443:443/other.json",
expected: "https://0/other.json",
expected: base,
},
{
name: "duplicate slashes, relative",
Expand Down
Loading