diff --git a/netbox/templates/base/layout.html b/netbox/templates/base/layout.html index da2d10c65..0def1c90e 100644 --- a/netbox/templates/base/layout.html +++ b/netbox/templates/base/layout.html @@ -33,7 +33,7 @@
- {% search_options %} + {% search_options request %}
@@ -45,7 +45,7 @@ {# Search bar #}
- {% search_options %} + {% search_options request %}
{# Proflie/login button #} diff --git a/netbox/utilities/templates/search/searchbar.html b/netbox/utilities/templates/search/searchbar.html index d71fd8e69..74d12e9b9 100644 --- a/netbox/utilities/templates/search/searchbar.html +++ b/netbox/utilities/templates/search/searchbar.html @@ -5,7 +5,7 @@ aria-label="Search" placeholder="Search" class="form-control" - value="{{ request.GET.q }}" + value="{{ request.GET.q|escape }}" /> diff --git a/netbox/utilities/templatetags/search.py b/netbox/utilities/templatetags/search.py index aad533e7e..5726ae5d5 100644 --- a/netbox/utilities/templatetags/search.py +++ b/netbox/utilities/templatetags/search.py @@ -8,6 +8,9 @@ search_form = SearchForm() @register.inclusion_tag("search/searchbar.html") -def search_options() -> Dict: +def search_options(request) -> Dict: """Provide search options to template.""" - return {"options": search_form.options} + return { + 'options': search_form.options, + 'request': request, + }