]> cat aescling's git repositories - mastodon.git/commitdiff
Fix up try/catch block in invalid URL handling
authorThibaut Girka <thib@sitedethib.com>
Tue, 6 Aug 2019 10:56:19 +0000 (12:56 +0200)
committerThibG <thib@sitedethib.com>
Tue, 6 Aug 2019 11:09:49 +0000 (13:09 +0200)
app/javascript/flavours/glitch/components/status_content.js

index 20e640bcb638204baaa457d9cf7dd9487ae51017..f8b101dc4270789d5f5d5fbaeb827f62cc1691c5 100644 (file)
@@ -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');
         }
       }