Module: check_mk
Branch: master
Commit: 3d630be10c11344a14182c2cb61e920862992917
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3d630be10c1134…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 20 14:26:25 2018 +0100
5853 FIX Fixed escaped HTML entities in view columns
When creating a PDF report which contains a view element. The columns
in this view could contain HTML escaped special characters like
"&quot;".
These signs are now displayed correctly in the PDF export.
Change-Id: Icafe74d682d18daa979e9bb26c46e2dd48ed17fb
---
.werks/5853 | 13 +++++++++++++
web/htdocs/htmllib.py | 7 +++++++
web/htdocs/views.py | 1 +
3 files changed, 21 insertions(+)
diff --git a/.werks/5853 b/.werks/5853
new file mode 100644
index 0000000..e2c1aa6
--- /dev/null
+++ b/.werks/5853
@@ -0,0 +1,13 @@
+Title: Fixed escaped HTML entities in view columns
+Level: 1
+Component: reporting
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.5.0i4
+Date: 1519133099
+
+When creating a PDF report which contains a view element. The columns
+in this view could contain HTML escaped special characters like
"&quot;".
+These signs are now displayed correctly in the PDF export.
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index e114929..025b97a 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -136,6 +136,13 @@ class Escaper(object):
.replace(">", ">")
+ def unescape_attributes(self, value):
+ return value.replace("&", "&")\
+ .replace(""", "\"")\
+ .replace("<", "<")\
+ .replace(">", ">")
+
+
# render HTML text.
# We only strip od some tags and allow some simple tags
# such as <h1>, <b> or <i> to be part of the string.
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 410c71a..cf1e5da 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -805,6 +805,7 @@ class Cell(object):
else:
txt = img_filename
+ txt = html.unescape_attributes(txt)
txt = html.strip_tags(txt)
return css_classes, txt