Skip to content
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

Ammonia panicked at "invalid URLs should be stripped earlier: EmptyHost" #136

Closed
Bauke opened this issue Mar 4, 2021 · 0 comments · Fixed by #137
Closed

Ammonia panicked at "invalid URLs should be stripped earlier: EmptyHost" #136

Bauke opened this issue Mar 4, 2021 · 0 comments · Fixed by #137

Comments

@Bauke
Copy link

Bauke commented Mar 4, 2021

Encountered this today, ammonia panicked when cleaning one of Troy Hunt's blog posts in my RSS reader.

Code and input data can be found in this repo. It seems something with ammonia::UrlRelative::RewriteWithBase is messing it up, when I remove that it doesn't panic. I skimmed through the HTML as well and didn't see anything out of the ordinary.

notriddle added a commit that referenced this issue Mar 4, 2021
It's possible for `Url::parse("xxx") == Err(url::ParseError::RelativeUrlWithoutBase)` to evaluate to true,
but for the eventual `url.join("xxx")` to still fail with a parse erro, depending on what "xxx" actually is.
To detect this, we check that joining succeeds in addition to the normal checks for relative URLs.

This PR also runs "cargo fmt".

Fixes #136
bors bot added a commit that referenced this issue Mar 4, 2021
137: Make sure that relative URLs actually work when filtering r=notriddle a=notriddle

It's possible for `Url::parse("xxx") == Err(url::ParseError::RelativeUrlWithoutBase)` to evaluate to true,
but for the eventual `url.join("xxx")` to still fail with a parse erro, depending on what "xxx" actually is.
To detect this, we check that joining succeeds in addition to the normal checks for relative URLs.

This PR also runs "cargo fmt".

Fixes #136

Co-authored-by: Michael Howell <[email protected]>
@bors bors bot closed this as completed in 4c73ef4 Mar 4, 2021
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 a pull request may close this issue.

1 participant