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

This commit is contained in:
jeremystretch 2023-05-24 15:45:24 -04:00
parent b31b086a4d
commit bf1c191b2e
2 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,10 @@
## 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)

View File

@ -274,10 +274,10 @@ class CustomLink(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
: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:
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 ''
# Sanitize link text