From 16018024c209bc03f6b4c898e7a2f0479cd9be6f Mon Sep 17 00:00:00 2001 From: "Stephane Lacoin (aka nxmatic)" Date: Sun, 30 Jun 2024 15:24:27 +0200 Subject: [PATCH] BDE-231 allow entering custom uuid in search form using uuid: prefix --- src/popup/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/popup/index.js b/src/popup/index.js index 69785ae..70551b0 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -322,7 +322,7 @@ function loadPage(worker) { let serverUrl; const regexes = {}; - regexes.uuid = /[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/; + regexes.uuid = /(?:uuid:)(?[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|.*)/; regexes.repo = /[A-Za-z_\.0-9-]+/; regexes.path = /\/[A-Za-z\.0-9_\- \/%~:?#'"]+/; @@ -517,10 +517,10 @@ function loadPage(worker) { function exportCurrentLink(docPathOrId) { $('#export-current').css('display', 'block'); $('#export-current').click(() => { - if (regexes.uuid.test(docPathOrId)) { - getJsonFromGuid(docPathOrId); - } else if (docPathOrId.startsWith('/')) { + if (docPathOrId.startsWith('/')) { getJsonFromPath(docPathOrId); + } else { + getJsonFromGuid(docPathOrId); } }); } @@ -781,14 +781,14 @@ function loadPage(worker) { $('#search').css('text-indent', '5px'); $('body').css('overflow-y', 'hidden'); $('html').css('height', 'auto'); - } else if (regexes.uuid.test(input)) { - getJsonFromGuid(input); - $('#loading-gif').css('display', 'none'); - $('#search').css('text-indent', '5px'); } else if (pathPattern.test(input)) { getJsonFromPath(input); $('#loading-gif').css('display', 'none'); $('#search').css('text-indent', '5px'); + } else if (regexes.uuid.test(input)) { + getJsonFromGuid(regexes.uuid.exec(input)[1]); + $('#loading-gif').css('display', 'none'); + $('#search').css('text-indent', '5px'); } else if ( input.toUpperCase().indexOf('SELECT ') !== -1 && input.toUpperCase().indexOf(' FROM ') !== -1