diff options
-rw-r--r-- | app/assets/javascripts/app/helpers/text_formatter.js | 7 | ||||
-rw-r--r-- | spec/javascripts/app/helpers/text_formatter_spec.js | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/app/assets/javascripts/app/helpers/text_formatter.js b/app/assets/javascripts/app/helpers/text_formatter.js index d5ae68444..9f27029c6 100644 --- a/app/assets/javascripts/app/helpers/text_formatter.js +++ b/app/assets/javascripts/app/helpers/text_formatter.js @@ -45,9 +45,12 @@ $(function() { } // url*DE*code as much as possible - while( unicodeUrl.indexOf("%") !== -1 && unicodeUrl != decodeURI(unicodeUrl) ) { - unicodeUrl = decodeURI(unicodeUrl); + try { + while( unicodeUrl.indexOf("%") !== -1 && unicodeUrl != decodeURI(unicodeUrl) ) { + unicodeUrl = decodeURI(unicodeUrl); + } } + catch(e){} // markdown doesn't like '(' or ')' anywhere, except where it wants var workingUrl = unicodeUrl.replace(/\(/, "%28").replace(/\)/, "%29"); diff --git a/spec/javascripts/app/helpers/text_formatter_spec.js b/spec/javascripts/app/helpers/text_formatter_spec.js index 334321d5a..14d8a149c 100644 --- a/spec/javascripts/app/helpers/text_formatter_spec.js +++ b/spec/javascripts/app/helpers/text_formatter_spec.js @@ -88,7 +88,8 @@ describe("app.helpers.textFormatter", function(){ "http://موقع.وزارة-الاتصالات.مصر/", // example from #3082 "http:///scholar.google.com/citations?view_op=top_venues", "http://lyricstranslate.com/en/someone-you-നിന്നെ-പോലൊരാള്.html", // example from #3063, - "http://de.wikipedia.org/wiki/Liste_der_Abkürzungen_(Netzjargon)" // #3645 + "http://de.wikipedia.org/wiki/Liste_der_Abkürzungen_(Netzjargon)", // #3645 + "http://wiki.com/?query=Kr%E4fte", // #4874 ]; this.asciiUrls = [ "http://www.xn--brgerentscheid-krankenhuser-xkc78d.de", @@ -96,7 +97,8 @@ describe("app.helpers.textFormatter", function(){ "http://xn--4gbrim.xn----ymcbaaajlc6dj7bxne2c.xn--wgbh1c/", "http:///scholar.google.com/citations?view_op=top_venues", "http://lyricstranslate.com/en/someone-you-%E0%B4%A8%E0%B4%BF%E0%B4%A8%E0%B5%8D%E0%B4%A8%E0%B5%86-%E0%B4%AA%E0%B5%8B%E0%B4%B2%E0%B5%8A%E0%B4%B0%E0%B4%BE%E0%B4%B3%E0%B5%8D%E2%80%8D.html", - "http://de.wikipedia.org/wiki/Liste_der_Abk%C3%BCrzungen_%28Netzjargon%29" + "http://de.wikipedia.org/wiki/Liste_der_Abk%C3%BCrzungen_%28Netzjargon%29", + "http://wiki.com/?query=Kr%E4fte", ]; }); |