mirror of
https://github.com/zulip/zulip.git
synced 2026-07-15 21:03:26 +08:00
bugdown: Assume http:// for links without a protocol
It's unlikely that users want relative links within humbughq.com. Fixes #447. (imported from commit d43a5758e6df448b07f56dc2de28078adaab8aeb)
This commit is contained in:
parent
d8b6cfdc11
commit
3829c8fd7f
@ -65,6 +65,12 @@ class LinkPattern(markdown.inlinepatterns.Pattern):
|
||||
# Bad url - so bad it couldn't be parsed.
|
||||
return ''
|
||||
|
||||
# Humbug modification: If scheme is not specified, assume http://
|
||||
# It's unlikely that users want relative links within humbughq.com.
|
||||
# We re-enter sanitize_url because netloc etc. need to be re-parsed.
|
||||
if not scheme:
|
||||
return self.sanitize_url('http://' + url)
|
||||
|
||||
locless_schemes = ['', 'mailto', 'news']
|
||||
if netloc == '' and scheme not in locless_schemes:
|
||||
# This fails regardless of anything else.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user