Merge pull request #4280 from matrix-org/dbkr/fix_permalink_crash

Fix soft-crash on bad permalinks
This commit is contained in:
David Baker 2020-03-26 10:54:59 +00:00 committed by GitHub
commit 5986bbc561
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -200,6 +200,7 @@ matrixLinkify.options = {
switch (type) { switch (type) {
case "url": { case "url": {
// intercept local permalinks to users and show them like userids (in userinfo of current room) // intercept local permalinks to users and show them like userids (in userinfo of current room)
try {
const permalink = parsePermalink(href); const permalink = parsePermalink(href);
if (permalink && permalink.userId) { if (permalink && permalink.userId) {
return { return {
@ -208,6 +209,9 @@ matrixLinkify.options = {
}, },
}; };
} }
} catch (e) {
// OK fine, it's not actually a permalink
}
break; break;
} }
case "userid": case "userid":