Skip to content

Guard lazy urlsplit errors in canonicalize_url - #326

Merged
probably-jaden merged 2 commits into
mainfrom
fix/canonicalize-lazy-port-valueerror
Aug 4, 2026
Merged

Guard lazy urlsplit errors in canonicalize_url#326
probably-jaden merged 2 commits into
mainfrom
fix/canonicalize-lazy-port-valueerror

Conversation

@probably-jaden

Copy link
Copy Markdown
Contributor

urlsplit() rarely raises, but its .hostname/.port properties raise ValueError lazily on junk like a non-numeric port (http://a.test:root{--x/) — URLs the extraction regex can pick out of CSS-ish text. The existing guard only wrapped the split, so one such URL crashed a whole trace ingest. The guard now covers the full netloc normalization; unparsable input falls back to the raw string as documented. Regression test included.

🤖 Generated with Claude Code

@probably-jaden
probably-jaden merged commit 92237f6 into main Aug 4, 2026
2 checks passed
@probably-jaden
probably-jaden deleted the fix/canonicalize-lazy-port-valueerror branch August 4, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant