-
-
Notifications
You must be signed in to change notification settings - Fork 175
🐛 Raises meaningful exception when IPv6 URL is malformed #1512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
CodSpeed Performance ReportMerging #1512 will not alter performanceComparing Summary
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❌ Your project status has failed because the head coverage (98.08%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #1512 +/- ##
=======================================
Coverage 99.63% 99.63%
=======================================
Files 29 29
Lines 5795 5806 +11
Branches 265 265
=======================================
+ Hits 5774 5785 +11
Misses 18 18
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e3af387
to
5001d56
Compare
note: we agreed with Mael that he'll add a change note later on, while traveling |
5001d56
to
f89d97b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaelPic thanks for your contribution during the PyCon US Sprints last week!
Would you me able to make the following cosmetic changes? Or do you need us to pick up the PR and complete it instead?
…ersed Problem: If brackets are reversed or content inside brackets is empty, `bracketed_host` will be an empty string. In consequence, reaching the first element of `bracketed_host` returns an `IndexError`. Solution: Use `startswith` because it does not raise anything if the string is empty and then it fallbacks into the following check verifying the presence of `:`. Also, the raised message was made more generic but still keeps its meaning.
f89d97b
to
63ba8c5
Compare
Thanks @MaelPic |
What do these changes do?
For IPv6 URL, if brackets are set in reversed order (closing bracket before open bracket), the raised exception is now
ValueError("Invalid IPv6 URL")
, which is more convenient that the reported one (IndexError: string index out of range
).Are there changes in behavior for the user?
If url contains brackets in opposite order:
Previous behavior: exception
IndexError
is raisedNew behavior: exception
ValueError
is raisedRelated issue number
Fixes #1485
Checklist