From a67a0950dd05bbe494ede5dfd696fcc47dcc9107 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 10 Feb 2013 19:21:27 +0000 Subject: [PATCH] stop urls being encoded, not sure about other security implications here... --- src/node/utils/ExportTxt.js | 40 ++----------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/src/node/utils/ExportTxt.js b/src/node/utils/ExportTxt.js index d9ee708f..462583d3 100644 --- a/src/node/utils/ExportTxt.js +++ b/src/node/utils/ExportTxt.js @@ -129,8 +129,6 @@ function getTXTFromAtext(pad, atext, authorColors) var assem = Changeset.stringAssembler(); var openTags = []; - var urls = _findURLs(text); - var idx = 0; function processNextChars(numChars) @@ -239,7 +237,8 @@ function getTXTFromAtext(pad, atext, authorColors) //from but they break the abiword parser and are completly useless s = s.replace(String.fromCharCode(12), ""); - assem.append(_encodeWhitespace(Security.escapeHTML(s))); + // assem.append(_encodeWhitespace(Security.escapeHTML(s))); + assem.append(_encodeWhitespace(s)); } // end iteration over spans in line var tags2close = []; @@ -253,20 +252,6 @@ function getTXTFromAtext(pad, atext, authorColors) } } // end processNextChars - if (urls) - { - urls.forEach(function (urlData) - { - var startIndex = urlData[0]; - var url = urlData[1]; - var urlLength = url.length; - processNextChars(startIndex - idx); - // assem.append(''); - assem.append(url); - processNextChars(urlLength); - // assem.append(''); - }); - } processNextChars(text.length - idx); return _processSpaces(assem.toString()); @@ -452,24 +437,3 @@ function _processSpaces(s) // copied from ACE var _REGEX_WORDCHAR = /[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u1FFF\u3040-\u9FFF\uF900-\uFDFF\uFE70-\uFEFE\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]/; var _REGEX_SPACE = /\s/; -var _REGEX_URLCHAR = new RegExp('(' + /[-:@a-zA-Z0-9_.,~%+\/\\?=&#;()$]/.source + '|' + _REGEX_WORDCHAR.source + ')'); -var _REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:)/.source + _REGEX_URLCHAR.source + '*(?![:.,;])' + _REGEX_URLCHAR.source, 'g'); - -// returns null if no URLs, or [[startIndex1, url1], [startIndex2, url2], ...] - -function _findURLs(text) -{ - _REGEX_URL.lastIndex = 0; - var urls = null; - var execResult; - while ((execResult = _REGEX_URL.exec(text))) - { - urls = (urls || []); - var startIndex = execResult.index; - var url = execResult[0]; - urls.push([startIndex, url]); - } - - return urls; -} -