diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index 4a84032a8..9ef076beb 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -241,7 +241,7 @@ class App.Utils cleanup = (str) -> if str.match(/(<|>|&)/) - str = str.replace(/(<|>|&).+?$/, '').trim() + str = str.replace(/(.+?)(<|>|&).+?$/, "$1").trim() str # search for signature seperator "--\n" @@ -424,10 +424,10 @@ class App.Utils # get first marker markers = _.sortBy(markers, 'lineCount') if markers[0].type is 'seperator' - regex = new RegExp( "\>(\s{0,10}#{quote(markers[0].line)})\s{0,10}\<" ) + regex = new RegExp( "\>(\s{0,10}#{quote(App.Utils.htmlEscape(markers[0].line))})\s{0,10}\<" ) message.replace( regex, ">#{markerTemplate}\$1<" ) else - regex = new RegExp( "\>(\s{0,10}#{quote(markers[0].line)})" ) + regex = new RegExp( "\>(\s{0,10}#{quote(App.Utils.htmlEscape(markers[0].line))})" ) message.replace( regex, ">#{markerTemplate}\$1" ) # textReplaced = App.Utils.replaceTags( template, { user: { firstname: 'Bob', lastname: 'Smith' } } ) diff --git a/public/assets/tests/html-utils.js b/public/assets/tests/html-utils.js index bfc650a85..2d190d843 100644 --- a/public/assets/tests/html-utils.js +++ b/public/assets/tests/html-utils.js @@ -630,8 +630,13 @@ test("identify signature", function() { result = App.Utils.signatureIdentify(message, true) equal(result, should) - message = "