Merge pull request #4889 from hpetru/4874-malformed-url
Catch error from decodeURI for prevent crash in posts parsing
This commit is contained in:
commit
211963d320
3 changed files with 10 additions and 4 deletions
|
|
@ -32,6 +32,7 @@
|
|||
* OpenGraph: don't make description into links [#4492](https://github.com/diaspora/diaspora/issues/4492)
|
||||
* Don't cut off long tags in stream posts [#4864](https://github.com/diaspora/diaspora/issues/4864)
|
||||
* Do not replace earlier appearances of the name while mentioning somebody [#4868](https://github.com/diaspora/diaspora/issues/4868)
|
||||
* Catch exceptions when trying to decode an invalid URI [#4874](https://github.com/diaspora/diaspora/issues/4874)
|
||||
|
||||
## Features
|
||||
* You can report a single post by clicking the correct icon in the controler section [#4517](https://github.com/diaspora/diaspora/pull/4517)
|
||||
|
|
|
|||
|
|
@ -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