Skip to content

Commit 7614f42

Browse files
committed
#7612: Use escape() rather than strip_tags()
1 parent 318c8b8 commit 7614f42

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

netbox/extras/models/customfields.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django.core.validators import RegexValidator, ValidationError
88
from django.db import models
99
from django.urls import reverse
10-
from django.utils.html import strip_tags
10+
from django.utils.html import escape
1111
from django.utils.safestring import mark_safe
1212

1313
from extras.choices import *
@@ -288,7 +288,7 @@ def to_form_field(self, set_initial=True, enforce_required=True, for_csv_import=
288288
field.model = self
289289
field.label = str(self)
290290
if self.description:
291-
field.help_text = strip_tags(self.description)
291+
field.help_text = escape(self.description)
292292

293293
return field
294294

netbox/templates/inc/custom_fields_panel.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h5 class="card-header">
88
<table class="table table-hover attr-table">
99
{% for field, value in custom_fields.items %}
1010
<tr>
11-
<td><span title="{{ field.description|striptags }}">{{ field }}</span></td>
11+
<td><span title="{{ field.description|escape }}">{{ field }}</span></td>
1212
<td>
1313
{% if field.type == 'boolean' and value == True %}
1414
<i class="mdi mdi-check-bold text-success" title="True"></i>

0 commit comments

Comments
 (0)