From d6fae5c6ee81ffccde64772824a42565ceeb86cb Mon Sep 17 00:00:00 2001 From: btzr-io Date: Sun, 2 Jun 2019 14:26:33 -0600 Subject: [PATCH] fix validatenURI function --- src/ui/util/remark-lbry.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ui/util/remark-lbry.js b/src/ui/util/remark-lbry.js index ebdc2c42b..e8fe9eeb9 100644 --- a/src/ui/util/remark-lbry.js +++ b/src/ui/util/remark-lbry.js @@ -11,11 +11,12 @@ const createURI = (text, uri) => ({ children: [{ type: 'text', value: text }], }); -const validateURI = (match) => { +const validateURI = (match, eat) => { if (match) { try { const text = match[0]; const uri = parseURI(text); + console.info(text); // Create channel link if (uri.isChannel) { return eat(text)(createURI(uri.claimName, text)); @@ -26,18 +27,18 @@ const validateURI = (match) => { // Silent errors: console.error(err) } } -} +}; // Generate a markdown link from channel name function tokenizeMention(eat, value, silent) { const match = /^@(\w+)/.exec(value); - return validateURI(match); + return validateURI(match, eat); } // Generate a markdown link from lbry url function tokenizeURI(eat, value, silent) { - const match = /^(lbry:\/\/)+([A-z0-9-_#@])+/.exec(value); - return validateURI(match); + const match = /^(lbry:\/\/)+([A-z0-9-_#@:])+/.exec(value); + return validateURI(match, eat); } // Configure tokenizer for lbry urls