From cd9b1449b506774dc083e7df3ac84c4380c14563 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 4 Aug 2014 22:00:43 +0100 Subject: [PATCH] Escape open bracket at start of OSX notification messages fixes #391 --- src/ui/notifier.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ui/notifier.c b/src/ui/notifier.c index abc64cae..9682d388 100644 --- a/src/ui/notifier.c +++ b/src/ui/notifier.c @@ -219,7 +219,23 @@ _notify(const char * const message, int timeout, char *escaped_double = str_replace(message, "\"", "\\\""); char *escaped_single = str_replace(escaped_double, "`", "\\`"); - g_string_append(notify_command, escaped_single); + + if (escaped_single[0] == '<') { + g_string_append(notify_command, "\\<"); + g_string_append(notify_command, &escaped_single[1]); + } else if (escaped_single[0] == '[') { + g_string_append(notify_command, "\\["); + g_string_append(notify_command, &escaped_single[1]); + } else if (escaped_single[0] == '(') { + g_string_append(notify_command, "\\("); + g_string_append(notify_command, &escaped_single[1]); + } else if (escaped_single[0] == '{') { + g_string_append(notify_command, "\\{"); + g_string_append(notify_command, &escaped_single[1]); + } else { + g_string_append(notify_command, escaped_single); + } + g_string_append(notify_command, "\""); free(escaped_double); free(escaped_single);