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

bug: linkify with entities inside anchor strings are incorrectly escaped #704

Closed
mcleanmds opened this issue Apr 12, 2023 · 1 comment · Fixed by #720
Closed

bug: linkify with entities inside anchor strings are incorrectly escaped #704

mcleanmds opened this issue Apr 12, 2023 · 1 comment · Fixed by #720
Labels
untriaged Bug reports that haven't been triaged
Milestone

Comments

@mcleanmds
Copy link

mcleanmds commented Apr 12, 2023

Describe the bug

linkify on a string with entities inside anchor element text results in the & character of the entity being incorrect escaped to &
e.g.   ->  

** python and bleach versions (please complete the following information):**

  • Python Version: 3.9.5
  • Bleach Version: 6.0.0

To Reproduce

A simple test to reproduce the behavior:

>>> from bleach import linkify
text = r'<p><a href="/">Some&nbsp;entity&rsquo;s</a>More&nbsp;entity&rsquo;s</p>'
expected = r'<p><a href="/" rel="nofollow">Some&nbsp;entity&rsquo;s</a>More&nbsp;entity&rsquo;s</p>'
assert linkify(text) == expected 

Expected behavior

linkify(r'<a href="/">Some&nbsp;entity&rsquo;s</a>')
'<a href="/" rel="nofollow">Some&nbsp;entity&rsquo;s</a>'

Actual behavior

linkify(r'<a href="/">Some&nbsp;entity&rsquo;s</a>')
'<a href="/" rel="nofollow">Some&amp;nbsp;entity&amp;rsquo;s</a>'

Additional context

This bug was introduced in 6.0.0 with the fix for #501 and #692: #692

@mcleanmds mcleanmds added the untriaged Bug reports that haven't been triaged label Apr 12, 2023
@willkg willkg added this to the version 6.1.0 milestone Sep 18, 2023
@willkg
Copy link
Member

willkg commented Oct 6, 2023

Thank you for the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged Bug reports that haven't been triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants