Selaa lähdekoodia

Fixes #7981: Fix Markdown sanitization regex

jeremystretch 4 vuotta sitten
vanhempi
commit
40c6b172f7

+ 5 - 1
docs/release-notes/version-3.0.md

@@ -5,12 +5,16 @@
 ### Enhancements
 ### Enhancements
 
 
 * [#7751](https://github.com/netbox-community/netbox/issues/7751) - Get API user from LDAP only when `FIND_GROUP_PERMS` is enabled
 * [#7751](https://github.com/netbox-community/netbox/issues/7751) - Get API user from LDAP only when `FIND_GROUP_PERMS` is enabled
-* [#7823](https://github.com/netbox-community/netbox/issues/7823) - Fix issue where `return_url` is not honored when 'Save & Continue' button is present
 * [#7885](https://github.com/netbox-community/netbox/issues/7885) - Linkify VLAN name in VLANs table
 * [#7885](https://github.com/netbox-community/netbox/issues/7885) - Linkify VLAN name in VLANs table
 * [#7892](https://github.com/netbox-community/netbox/issues/7892) - Add L22-30 power port & outlet types
 * [#7892](https://github.com/netbox-community/netbox/issues/7892) - Add L22-30 power port & outlet types
 * [#7932](https://github.com/netbox-community/netbox/issues/7932) - Improve performance of the "quick find" function
 * [#7932](https://github.com/netbox-community/netbox/issues/7932) - Improve performance of the "quick find" function
 * [#7941](https://github.com/netbox-community/netbox/issues/7941) - Add multi-standard ITA power outlet type
 * [#7941](https://github.com/netbox-community/netbox/issues/7941) - Add multi-standard ITA power outlet type
 
 
+### Bug Fixes
+
+* [#7823](https://github.com/netbox-community/netbox/issues/7823) - Fix issue where `return_url` is not honored when 'Save & Continue' button is present
+* [#7981](https://github.com/netbox-community/netbox/issues/7981) - Fix Markdown sanitization regex
+
 ---
 ---
 
 
 ## v3.0.11 (2021-11-24)
 ## v3.0.11 (2021-11-24)

+ 1 - 1
netbox/utilities/templatetags/helpers.py

@@ -51,7 +51,7 @@ def render_markdown(value):
     value = re.sub(pattern, '[\\1](\\3)', value, flags=re.IGNORECASE)
     value = re.sub(pattern, '[\\1](\\3)', value, flags=re.IGNORECASE)
 
 
     # Sanitize Markdown reference links
     # Sanitize Markdown reference links
-    pattern = fr'\[(.+)\]:\w?(?!({schemes})).*:(.+)'
+    pattern = fr'\[(.+)\]:\s*(?!({schemes}))\w*:(.+)'
     value = re.sub(pattern, '[\\1]: \\3', value, flags=re.IGNORECASE)
     value = re.sub(pattern, '[\\1]: \\3', value, flags=re.IGNORECASE)
 
 
     # Render Markdown
     # Render Markdown