From f018c367ed8bb137e4ce2a2106d373b22442faa7 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 17 Jun 2023 14:30:17 +0000 Subject: [PATCH] Don't automatically add mentions for incomplete &/@/% links. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4328 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/ssb/tf-compose.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/ssb/tf-compose.js b/apps/ssb/tf-compose.js index fbeab91a..26f589c2 100644 --- a/apps/ssb/tf-compose.js +++ b/apps/ssb/tf-compose.js @@ -37,6 +37,11 @@ class TfComposeElement extends LitElement { for (let match of text.matchAll(/\[([^\[]+)]\(([@&%][^\)]+)/g)) { let name = match[1]; let link = match[2]; + if ((link.startsWith('&') && link.length != 52) || + (link.startsWith('@') && link.length != 53) || + (link.startsWith('%') && link.length != 52)) { + continue; + } let balance = 0; let bracket_end = match.index + match[1].length + '[]'.length - 1; for (let i = bracket_end; i >= 0; i--) {