Skip to content
Myr

don't apply `urlize` to `@a@b` (#2062)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents 106d61c, 0cd6948 · Browse files · 3 files+11 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+11 added−0 removed

  • tests:+8 added−0 removed
  • other:+3 added−0 removed

3 files+11 added−0 removed

modified:src/jinja2/utils.py+2 added
331 unmodified lines
332333 elif (334 "@" in middle335 and not middle.startswith("www.")336 # ignore values like `@a@b`337 and not middle.startswith("@")338 and ":" not in middle339 and _email_re.match(middle)340 ):341 middle = f'<a href="mailto:{middle}">{middle}</a>'
425 unmodified lines
modified:tests/test_utils.py+8 added
140 unmodified lines
141 ' target="&lt;script&gt;">'142 "http://example.org</a>"143 )144145 def test_urlize_mail_mastodon(self):146 fr = "nabijaczleweli@nabijaczleweli.xyz\n@eater@cijber.social\n"147 to = (148 '<a href="mailto:nabijaczleweli@nabijaczleweli.xyz">'149 "nabijaczleweli@nabijaczleweli.xyz</a>\n@eater@cijber.social\n"150 )151 assert urlize(fr) == to152153154class TestLoremIpsum:155 def test_lorem_ipsum_markup(self):156 """Test that output of lorem_ipsum is Markup by default."""157 assert isinstance(generate_lorem_ipsum(), Markup)
48 unmodified lines
modified:CHANGES.rst+1 added
38 unmodified lines
39 searched. :issue:`1661`40- ``PackageLoader`` shows a clearer error message when the package does not41 contain the templates directory. :issue:`1705`42- Improve annotations for methods returning copies. :pr:`1880`43- ``urlize`` does not add ``mailto:`` to values like `@a@b`. :pr:`1870`444546Version 3.1.447-------------
994 unmodified lines