Module: check_mk
Branch: master
Commit: 93574619bd6e802b056c5f09f5229f8fdf176460
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=93574619bd6e80…
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
Module: check_mk
Branch: master
Commit: e88012ed242fb5ba631c94c1faccd011458316ca
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e88012ed242fb5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 20 12:45:14 2018 +0100
Only remove check variable settings from default_config when it was set before
Change-Id: Id4046592c86718fc492977be9d0c0e4f94d0d732
---
cmk_base/config.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cmk_base/config.py b/cmk_base/config.py
index c1e94a8..52d6395 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -80,12 +80,18 @@ def add_check_variables(check_variables):
#
# In the same step we remove the check related configuration settings from the
# config module because they are not needed there anymore.
+#
+# And also remove it from the default config (in case it was present)
def set_check_variables_for_checks():
import cmk_base.checks
global_dict = globals()
for varname in cmk_base.checks.check_variable_names():
cmk_base.checks.set_check_variable(varname, global_dict.pop(varname))
- delattr(default_config, varname)
+
+ try:
+ delattr(default_config, varname)
+ except AttributeError:
+ pass
#.