This is an automated email from the ASF dual-hosted git repository. brondsem pushed a commit to branch db/8416 in repository https://gitbox.apache.org/repos/asf/allura.git
commit b6f80f5149c607f1e6cef9d86eecb898f7b4af9b Author: Dave Brondsema <dbronds...@slashdotmedia.com> AuthorDate: Wed Mar 2 14:59:38 2022 -0500 [#8416] use regex library everywhere, particularly within Markdown library that handles some of our markdown extensions --- Allura/allura/lib/markdown_extensions.py | 2 +- Allura/allura/tests/functional/test_site_admin.py | 2 +- Allura/allura/tests/test_globals.py | 10 +++++----- requirements.in | 1 + requirements.txt | 4 ++++ 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Allura/allura/lib/markdown_extensions.py b/Allura/allura/lib/markdown_extensions.py index e3844f8..b72bbda 100644 --- a/Allura/allura/lib/markdown_extensions.py +++ b/Allura/allura/lib/markdown_extensions.py @@ -51,7 +51,7 @@ SHORT_REF_RE = markdown.inlinepatterns.NOIMG + r'\[([^\]]+)\]' # FORGE_LINK_RE copied from markdown pre 3.0's LINK_RE # TODO: replace these with newer approach, see ForgeLinkPattern -NOBRACKET = r'[^\]\[]{0,50}' # "*" changed to {0,50} for performance mitigation +NOBRACKET = r'[^\]\[]{0,100}' # "*" changed to {0,100} for performance mitigation BRK = ( r'\[(' + (NOBRACKET + r'(\[')*6 + diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py index cec0a86..3b96410 100644 --- a/Allura/allura/tests/functional/test_site_admin.py +++ b/Allura/allura/tests/functional/test_site_admin.py @@ -139,7 +139,7 @@ class TestSiteAdmin(TestController): r = self.app.get( url, extra_environ=dict(username=str('*anonymous')), status=302) r = self.app.get(url) - assert 're.search' in r, r + assert 'regex.regex.search' in r, r assert '<td>pattern</td>' in r, r assert '<td>string</td>' in r, r assert '<th class="second-column-headers side-header">flags</th>' in r, r diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py index 3974764..bab4591 100644 --- a/Allura/allura/tests/test_globals.py +++ b/Allura/allura/tests/test_globals.py @@ -652,11 +652,11 @@ def test_markdown_link_length_limits(): text = g.markdown.convert('See [this is 26 characters long](Home)') assert 'href="/p/test/wiki-len/Home/">this is 26 characters long</a>' in text, text # {0,12} fails {0,13} ok - # breaking point, currently. Would be nice if this worked and made a real link: - char110long = '1234567890'*11 - text = g.markdown.convert(f'See [{char110long}](Home)') - assert f'<span>[{char110long}]</span>(Home)' in text, text # current limitation, not a link - # assert f'href="/p/test/wiki-len/Home/">{char110long}</a>' in text, text # ideal output + # limit, currently + charSuperLong = '1234567890'*21 + text = g.markdown.convert(f'See [{charSuperLong}](Home)') + assert f'<span>[{charSuperLong}]</span>(Home)' in text, text # current limitation, not a link + # assert f'href="/p/test/wiki-len/Home/">{charSuperLong}</a>' in text, text # ideal output @td.with_wiki diff --git a/requirements.in b/requirements.in index 6b8fc92..1546be7 100644 --- a/requirements.in +++ b/requirements.in @@ -38,6 +38,7 @@ python-magic python-oembed pytz qrcode +regex-as-re-globally requests requests-oauthlib # for taskd proc name switching diff --git a/requirements.txt b/requirements.txt index 3491105..259c293 100644 --- a/requirements.txt +++ b/requirements.txt @@ -150,6 +150,10 @@ pytz==2021.3 # ming qrcode==6.1 # via -r requirements.in +regex==2022.3.2 + # via regex-as-re-globally +regex-as-re-globally==0.0.2 + # via -r requirements.in repoze.lru==0.7 # via turbogears2 requests==2.26.0