Catch error from decodeURI for prevent crash in posts parsing
This commit is contained in:
parent
b207077405
commit
552310796c
2 changed files with 9 additions and 4 deletions
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
];
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue