From 3ea7a334d89d2c4075b1dbf649d692ff49325f2e Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Tue, 6 Aug 2019 12:56:19 +0200 Subject: [PATCH] Fix up try/catch block in invalid URL handling --- app/javascript/flavours/glitch/components/status_content.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/components/status_content.js b/app/javascript/flavours/glitch/components/status_content.js index 20e640bcb63..f8b101dc427 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'); } }