From df44ca5bcfbe2843deecdbf58772241347170726 Mon Sep 17 00:00:00 2001 From: btzr-io Date: Sun, 2 Jun 2019 16:33:47 -0600 Subject: [PATCH] fix regular expression for lbry urls --- src/ui/util/remark-lbry.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ui/util/remark-lbry.js b/src/ui/util/remark-lbry.js index e8fe9eeb9..de1600fe8 100644 --- a/src/ui/util/remark-lbry.js +++ b/src/ui/util/remark-lbry.js @@ -16,9 +16,8 @@ const validateURI = (match, eat) => { try { const text = match[0]; const uri = parseURI(text); - console.info(text); // Create channel link - if (uri.isChannel) { + if (uri.isChannel && !uri.path) { return eat(text)(createURI(uri.claimName, text)); } // Create uri link @@ -31,13 +30,13 @@ const validateURI = (match, eat) => { // Generate a markdown link from channel name function tokenizeMention(eat, value, silent) { - const match = /^@(\w+)/.exec(value); + const match = /^@+[a-zA-Z0-9-#:/]+/.exec(value); return validateURI(match, eat); } // Generate a markdown link from lbry url function tokenizeURI(eat, value, silent) { - const match = /^(lbry:\/\/)+([A-z0-9-_#@:])+/.exec(value); + const match = /^(lbry:\/\/)+[a-zA-Z0-9-@#:/]+/.exec(value); return validateURI(match, eat); }