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
Fix parsing "meta" tag with encoding attribute #432
Conversation
When parsing a <meta encoding=""> tag, the parser calls charEncoding and changeEncoding in the input stream, but the InputStreamWithMemory wrapper didn't have those methods. This fixes that. This also creates a new test set for BleachHTMLParser functionality. Fixes #431
@@ -1,7 +1,7 @@ | |||
Bleach changes | |||
============== | |||
|
|||
Version 3.0.3 (In development) | |||
Version 3.1.0 (In development) |
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.
We're adding backwards-compatible API changes, so this needs to be a MINOR increment rather than a PATCH increment.
@@ -25,6 +25,12 @@ None | |||
* Fix cases where attribute names could have invalid characters in them. | |||
(#419) | |||
|
|||
* Fix problems with ``LinkifyFilter`` not being able to match links | |||
across ``&``. (#422) |
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.
I should have added this in the last PR.
@@ -80,3 +80,65 @@ def test_serializer(data, expected): | |||
serialized = serializer.render(walker(dom)) | |||
|
|||
assert serialized == expected | |||
|
|||
|
|||
@pytest.mark.parametrize('parser_args, data, expected', [ |
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.
This tests the specific issue here plus other interesting BleachHTMLParser
behavior.
{}, | ||
'<a href=\'http://example.com\'\'>', | ||
'<a href="http://example.com"></a>' | ||
) |
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.
We had a LinkifyFilter
test that tested this. I nixed that test and moved the relevant parts here where they're not encumbered by LinkifyFilter
things.
'<a href="http://example.com/" rel="nofollow"></a>' | ||
) | ||
|
||
|
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.
The important part of this got moved to the BleachHTMLParser
tests.
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.
r+ lgtm
Thank you! |
When parsing a tag, the parser calls charEncoding
and changeEncoding in the input stream, but the InputStreamWithMemory
wrapper didn't have those methods. This fixes that.
This also creates a new test set for BleachHTMLParser functionality.
Fixes #431