Module: check_mk
Branch: master
Commit: 6864989ff097975daa93d14c1ab9514298708e56
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6864989ff09797…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Mar 20 08:22:14 2019 +0100
7240 FIX Fixed possible exception when filtering views using non ASCII characters
A GUI timeout or UnicodeDecodeError messages could occur when trying to filter
views using non ASCII characters, like e.g. Umlauts. This could e.g. occur for
users when trying to view service detail pages of services that have such
characters in their names.
Change-Id: I6e7e9859bfeab9be1a0254b54fef63aa3306914e
---
.werks/7240 | 14 ++++++++++++++
cmk/gui/plugins/visuals/filters.py | 10 ++--------
cmk/gui/views.py | 2 +-
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/.werks/7240 b/.werks/7240
new file mode 100644
index 0000000..2c77be2
--- /dev/null
+++ b/.werks/7240
@@ -0,0 +1,14 @@
+Title: Fixed possible exception when filtering views using non ASCII characters
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1553012514
+
+A GUI timeout or UnicodeDecodeError messages could occur when trying to filter
+views using non ASCII characters, like e.g. Umlauts. This could e.g. occur for
+users when trying to view service detail pages of services that have such
+characters in their names.
diff --git a/cmk/gui/plugins/visuals/filters.py b/cmk/gui/plugins/visuals/filters.py
index c158a18..1716c20 100644
--- a/cmk/gui/plugins/visuals/filters.py
+++ b/cmk/gui/plugins/visuals/filters.py
@@ -87,16 +87,13 @@ class FilterText(Filter):
negate = ""
if current_value:
- if isinstance(current_value, unicode):
- current_value = current_value.encode("utf-8")
return "Filter: %s %s%s %s\n" % (
self.column,
negate,
self.op,
livestatus.lqencode(current_value),
)
- else:
- return ""
+ return ""
def variable_settings(self, row):
return [(self.htmlvars[0], row[self.column])]
@@ -295,15 +292,12 @@ class FilterHostnameOrAlias(FilterUnicode):
negate = ""
if current_value:
- if isinstance(current_value, unicode):
- current_value = current_value.encode("utf-8")
return "Filter: host_name %s%s %s\nFilter: alias %s%s %s\nOr: 2\n"
% ((
negate,
self.op,
livestatus.lqencode(current_value),
) * 2)
- else:
- return ""
+ return ""
class FilterIPAddress(Filter):
diff --git a/cmk/gui/views.py b/cmk/gui/views.py
index 0ec3451..fd118ea 100644
--- a/cmk/gui/views.py
+++ b/cmk/gui/views.py
@@ -2302,7 +2302,7 @@ def query_action_data(what, host, site, svcdesc):
def ajax_popup_action_menu():
site = html.request.var('site')
host = html.request.var('host')
- svcdesc = html.request.var('service')
+ svcdesc = html.request.get_unicode_input('service')
what = 'service' if svcdesc else 'host'
display_options.load_from_html()