From 44f8f028d9fbb2f548f6ddd703c630ad01659626 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Thu, 19 Feb 2009 07:37:57 +0100 Subject: [PATCH] Do escaping using regexps with /g instead For some reason when using the normal string.replace("", ""), not all the characters would be replaced. However, when using regexps as the search term, the replace is successful. This fixes the issue where some patches are suddently interpretted as HTML code instead. For example, patches which contains XML tags would be mangled before this fix. Signed-off-by: Marius Storm-Olsen --- content/overlay.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/overlay.js b/content/overlay.js index 2fcfc3f..74c7dd2 100644 --- a/content/overlay.js +++ b/content/overlay.js @@ -28,8 +28,8 @@ var ThunderGit = { plaintext2html: function (str) { return "
"
-            + str.replace("&", "&").replace("\"", """)
-            .replace("<", "<").replace(">", ">").replace("\n", "
") + + str.replace(/&/g, "&").replace(/\"/g, """) + .replace(//g, ">") + "
"; }, @@ -72,7 +72,7 @@ var ThunderGit = { params.identity = accountManager.getFirstIdentityForServer(GetLoadedMsgFolder().server); // strip carriage returns - str = str.replace("\r", ""); + str = str.replace(/\r\n/g, "\n"); if (this.startsWith(str, "From ")) { // we got a header var headerEnd = str.indexOf("\n\n"); -- 2.11.4.GIT