Fix MFM URL parsing

This commit is contained in:
syuilo 2019-06-17 20:15:19 +09:00
parent 63c659bc8f
commit 285d0d13f9
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
2 changed files with 12 additions and 2 deletions

View file

@ -164,8 +164,10 @@ export const mfmLanguage = P.createLanguage({
} else
url = match[0];
url = removeOrphanedBrackets(url);
if (url.endsWith('.')) url = url.substr(0, url.lastIndexOf('.'));
if (url.endsWith(',')) url = url.substr(0, url.lastIndexOf(','));
while (url.endsWith('.') || url.endsWith(',')) {
if (url.endsWith('.')) url = url.substr(0, url.lastIndexOf('.'));
if (url.endsWith(',')) url = url.substr(0, url.lastIndexOf(','));
}
return P.makeSuccess(i + url.length, url);
}).map(x => createLeaf('url', { url: x }));
},