about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-08-06 12:56:19 +0200
committerThibG <thib@sitedethib.com>2019-08-06 13:09:49 +0200
commit3ea7a334d89d2c4075b1dbf649d692ff49325f2e (patch)
tree49720740f386779a081ccffceeb8b8436f4b76f3
parentcbd75fe1284f67c941967f20ab9fef508ed70e1c (diff)
Fix up try/catch block in invalid URL handling
-rw-r--r--app/javascript/flavours/glitch/components/status_content.js6
1 files 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 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');
         }
       }