From: Thibaut Girka Date: Tue, 6 Aug 2019 10:56:19 +0000 (+0200) Subject: Fix up try/catch block in invalid URL handling X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=3ea7a334d89d2c4075b1dbf649d692ff49325f2e;p=mastodon.git Fix up try/catch block in invalid URL handling --- diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js index 20e640bcb..f8b101dc4 100644 --- a/app/javascript/flavours/glitch/components/status_content.js +++ b/app/javascript/flavours/glitch/components/status_content.js @@ -116,9 +116,9 @@ export default class StatusContent extends React.PureComponent { link.insertAdjacentText('beforeend', ' '); link.insertAdjacentElement('beforeend', tag); } - } catch (TypeError) { - // Just to be safe - if (tagLinks) link.removeAttribute('href'); + } catch (e) { + // The URL is invalid, remove the href just to be safe + if (tagLinks && e instanceof TypeError) link.removeAttribute('href'); } }