diff --git a/pagure/pfmarkdown.py b/pagure/pfmarkdown.py index cb05477..57062b4 100644 --- a/pagure/pfmarkdown.py +++ b/pagure/pfmarkdown.py @@ -282,8 +282,10 @@ class PagureExtension(markdown.extensions.Extension): def extendMarkdown(self, md, md_globals): # First, make it so that bare links get automatically linkified. markdown.inlinepatterns.AUTOLINK_RE = '(%s)' % '|'.join([ - r'<(?:f|ht)tps?://[^>]*>', - r'\b(?:f|ht)tps?://[^)<>\s]+[^.,)<>\s]', + r'<((?:[Ff]|[Hh][Tt])[Tt][Pp][Ss]?://[^>]*)>', + r'\b(?:[Ff]|[Hh][Tt])[Tt][Pp][Ss]?://[^)<>\s]+[^.,)<>\s]', + r'<(Ii][Rr][Cc][Ss]?://[^>]*)>', + r'\b[Ii][Rr][Cc][Ss]?://[^)<>\s]+[^.,)<>\s]', ]) md.inlinePatterns['mention'] = MentionPattern(MENTION_RE) diff --git a/tests/test_pagure_lib.py b/tests/test_pagure_lib.py index 0697f5b..266f329 100644 --- a/tests/test_pagure_lib.py +++ b/tests/test_pagure_lib.py @@ -3345,6 +3345,10 @@ class PagureLibtests(tests.Modeltests): 'pingou opened the PR forks/pingou/test#2', 'fork/pingou/ns/test#8 is private', 'pingou committed on test#9364354a4555ba17aa60f0dc844d70b74eb1aecd', + 'irc://pagure.io', + 'ircs://pagure.io', + 'http://pagure.io', + 'https://pagure.io', ] expected = [ # 'foo bar test#1 see?', @@ -3383,7 +3387,18 @@ class PagureLibtests(tests.Modeltests): '

pingou committed on test#9364354a4555ba17aa60f0dc844d70b74eb1aecd

' + '>test#9364354a4555ba17aa60f0dc844d70b74eb1aecd

', + # 'irc://pagure.io' + '

irc://pagure.io

', + # 'ircs://pagure.io' - This is getting cleaned by python-bleach + # and the version 1.4.3 that we have won't let us adjust the + # list of supported protocols + # '

ircs://pagure.io

', + '

irc://pagure.io

', + # 'http://pagure.io' + '

http://pagure.io

', + # 'https://pagure.io' + '

https://pagure.io

', ] with pagure.APP.app_context():