Explorar el Código

Fixes #12694: Strip leading & trailing whitespace from custom link URL & text

jeremystretch hace 2 años
padre
commit
bf1c191b2e
Se han modificado 2 ficheros con 6 adiciones y 2 borrados
  1. 4 0
      docs/release-notes/version-3.5.md
  2. 2 2
      netbox/extras/models/models.py

+ 4 - 0
docs/release-notes/version-3.5.md

@@ -2,6 +2,10 @@
 
 
 ## v3.5.3 (FUTURE)
 ## v3.5.3 (FUTURE)
 
 
+### Bug Fixes
+
+* [#12694](https://github.com/netbox-community/netbox/issues/12694) - Strip leading & trailing whitespace from custom link URL & text
+
 ---
 ---
 
 
 ## v3.5.2 (2023-05-22)
 ## v3.5.2 (2023-05-22)

+ 2 - 2
netbox/extras/models/models.py

@@ -274,10 +274,10 @@ class CustomLink(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
 
 
         :param context: The context passed to Jinja2
         :param context: The context passed to Jinja2
         """
         """
-        text = render_jinja2(self.link_text, context)
+        text = render_jinja2(self.link_text, context).strip()
         if not text:
         if not text:
             return {}
             return {}
-        link = render_jinja2(self.link_url, context)
+        link = render_jinja2(self.link_url, context).strip()
         link_target = ' target="_blank"' if self.new_window else ''
         link_target = ' target="_blank"' if self.new_window else ''
 
 
         # Sanitize link text
         # Sanitize link text