mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -06:00
Fix for #5506
This commit is contained in:
parent
1e5778e6db
commit
b9ea630e72
@ -36,11 +36,15 @@ def render_markdown(value):
|
||||
"""
|
||||
Render text as Markdown
|
||||
"""
|
||||
schemes = '|'.join(settings.ALLOWED_URL_SCHEMES)
|
||||
|
||||
# Fix for angle brackets markdown
|
||||
value = re.sub(fr"<(?={schemes}:)(.*?)>", "[\\1](\\1)", value, flags=re.MULTILINE|re.IGNORECASE)
|
||||
|
||||
# Strip HTML tags
|
||||
value = strip_tags(value)
|
||||
|
||||
# Sanitize Markdown links
|
||||
schemes = '|'.join(settings.ALLOWED_URL_SCHEMES)
|
||||
pattern = fr'\[(.+)\]\((?!({schemes})).*:(.+)\)'
|
||||
value = re.sub(pattern, '[\\1](\\3)', value, flags=re.IGNORECASE)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user