Module: check_mk
Branch: master
Commit: b111ab7718e251fde58340ee2e2849c1e9ba21aa
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b111ab7718e251…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 13 10:58:33 2016 +0100
#2901 FIX Fixed issue editing availability annotations
Fixed a possible "Internal Server Error" when trying to edit annotations of
the Check_MK Availability which contains special characters in the text.
---
.werks/2901 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/htmllib.py | 10 +++++++++-
web/plugins/views/availability.py | 1 +
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/.werks/2901 b/.werks/2901
new file mode 100644
index 0000000..c331de6
--- /dev/null
+++ b/.werks/2901
@@ -0,0 +1,10 @@
+Title: Fixed issue editing availability annotations
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i4
+Date: 1452679030
+Class: fix
+
+Fixed a possible "Internal Server Error" when trying to edit annotations of
+the Check_MK Availability which contains special characters in the text.
diff --git a/ChangeLog b/ChangeLog
index 32c20d9..687eb47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -213,6 +213,7 @@
* 2895 FIX: Fixed broken "back to view" links after checkbox actions in
views...
* 2896 FIX: Improved handling of wrong encoded input strings...
* 2822 FIX: Availabiltiy: Fixed exception while rendering the timeline...
+ * 2901 FIX: Fixed issue editing availability annotations...
WATO:
* 2442 WATO remove host: improved cleanup of obsolete host files...
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 56c5ff9..a354f3b 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -181,7 +181,15 @@ class html(GUITester):
def flush(self):
if self.plugged:
- self.lowlevel_write(self.plugged_text)
+ text = self.plugged_text
+
+ # encode when really writing out the data. Not when writing plugged,
+ # because the plugged code will be handled somehow by our code. We
+ # only encode when leaving the pythonic world.
+ if type(text) == unicode:
+ text = text.encode("utf-8")
+
+ self.lowlevel_write(text)
self.plugged_text = ''
def drain(self):
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 43f0225..68dc92f 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -715,6 +715,7 @@ def edit_annotation():
annotation["service"] = service
annotation["site"] = site_id
+ # FIXME: Why use plugging here? Can we clean this up?
html.plug()
title = _("Edit annotation of ") + hostname