This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new 8eac95713 add @ to url autolink pattern
8eac95713 is described below
commit 8eac9571383b7181742de6f8f973b17998281b98
Author: Dave Brondsema <[email protected]>
AuthorDate: Wed Jul 12 13:29:39 2023 -0400
add @ to url autolink pattern
---
Allura/allura/lib/markdown_extensions.py | 2 +-
Allura/allura/tests/test_globals.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/Allura/allura/lib/markdown_extensions.py
b/Allura/allura/lib/markdown_extensions.py
index cc03be1b1..576f5e737 100644
--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -285,7 +285,7 @@ class ForgeExtension(markdown.Extension):
# this has to be before the 'escape' processor, otherwise weird
# placeholders are inserted for escaped chars within urls, and then the
# autolink can't match the whole url
-
md.inlinePatterns.register(AutolinkPattern(r'(http(?:s?)://[a-zA-Z0-9./\-\\_%?&=+#;~:!]+)',
md),
+
md.inlinePatterns.register(AutolinkPattern(r'(http(?:s?)://[a-zA-Z0-9./\-\\_%?&=+#;~:!@]+)',
md),
'autolink_without_brackets',
185) # was '<escape' and 'escape' is
priority 180; great num runs first, so: 185
# replace the link pattern with our extended version
diff --git a/Allura/allura/tests/test_globals.py
b/Allura/allura/tests/test_globals.py
index 6bc2e331d..627c633e6 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -547,6 +547,9 @@ class Test():
# beginning of a line
assert ('<br/>\n<a href="http://' in
g.markdown.convert('foobar\nhttp://domain.net abc'))
+ # special characters allowed
+ assert (' href="http://mst.dn/@acct:%20#target" ' in
+ g.markdown.convert('foo http://mst.dn/@acct:%20#target bar'))
# no conversion of these urls:
assert ('a blahttp://sdf.com z' in
g.markdown.convert('a blahttp://sdf.com z'))