mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-17 11:21:11 +02:00
Backport patch for #985
This commit is contained in:
@ -56,6 +56,19 @@ def get_markdown(text):
|
||||
if not text:
|
||||
return ""
|
||||
|
||||
pattern = fr'([\[\s\S\]]*?)\(([\s\S]*?):([\s\S]*?)\)'
|
||||
# Regex check
|
||||
if re.match(pattern, text):
|
||||
# get get value of group regex
|
||||
scheme = re.search(pattern, text, re.IGNORECASE).group(2)
|
||||
# scheme check
|
||||
if scheme in helpdesk_settings.ALLOWED_URL_SCHEMES:
|
||||
replacement = '\\1(\\2:\\3)'
|
||||
else:
|
||||
replacement = '\\1(\\3)'
|
||||
|
||||
text = re.sub(pattern, replacement, text, flags=re.IGNORECASE)
|
||||
|
||||
return mark_safe(
|
||||
markdown(
|
||||
text,
|
||||
|
Reference in New Issue
Block a user