-
Notifications
You must be signed in to change notification settings - Fork 253
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
extra " and ' get changed to attribute names #419
Comments
Hi! The first one is intended. Urls shouldn't have ambiguous ampersands, so linkify and clean escape those. The second one is in a quoted attribute value, and since linkify and clean both change values so that they're quoted, it doesn't need to get escaped. The spec for both of those is here: https://html.spec.whatwg.org/multipage/syntax.html#syntax-attributes The first and third examples in the third one are invalid HTML, so the tokenizer and parser are trying to fix the HTML to make it valid, but not doing a very good job here. That should get fixed. Thank you for reporting this! |
I want to:
Can I achieve this in any way? |
The first two requirements are fine. I don't think you can strictly achieve the third requirement with Bleach because linkify will fix invalid HTML. Why do you need linkify to not fix the HTML so that it's valid? |
My usecase is wrapping all links into other ones with redirect in order to monitor clicks from emails and site popups. So what I do is:
In case & is replaced with |
Can you show me the code? Otherwise I'm guessing and I don't have anything to tinker with. |
@M1hacka Can you show me the code you're using? |
This is causing issues for me as well, now that I switched to adding the Here's a pretty minimal demonstration:
Result (expected):
Result (not expected, link stops at the |
One more detail: it works if the
(with an additional |
@Deimos I'm pretty sure the issue you're describing is a different problem and not this one. Per #419 (comment), this issue is about solving the third item in the description which is "quote in link is converted to strange tag parameter ("="")". Can you write up a new issue for your |
I tinkered with the " issue and I think it's a bug in html5lib:
I don't think it should be fixing the " that way. I'll write up a bug there. |
I created html5lib/html5lib-python#407 in the html5lib project. I'll follow up on the problem there and then update Bleach accordingly. |
So, seems like it's getting parsed correctly and there are two parse errors that come out of that. I think we'll have to add some code to nix attributes that have invalid names. |
Hi.
I've found strange things in href escaping with
linkify
:&
symbol is converted to&
if it is present in href link:<
at link end) are not converted:"=""
):How can I get a correct href without any characters encoded?
The text was updated successfully, but these errors were encountered: