diff options
Diffstat (limited to 'html/payload_create.js')
-rw-r--r-- | html/payload_create.js | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/html/payload_create.js b/html/payload_create.js index c1563ae..503a461 100644 --- a/html/payload_create.js +++ b/html/payload_create.js @@ -46,7 +46,8 @@ #FROM html/DOM_helpers.js IMPORT clone_template #FROM common/sha256.js IMPORT sha256 -#FROM common/patterns.js IMPORT deconstruct_url, patterns_doc_url +#FROM common/patterns.js IMPORT validate_normalize_url_pattern, \ + patterns_doc_url /* https://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid */ /* This is a helper function used by uuidv4(). */ @@ -81,18 +82,8 @@ function collect_form_data(form_ctx) const payloads = {}; - for (const pattern of url_patterns) { - try { - deconstruct_url(pattern); - } catch(e) { - const patterns_doc_link = document.createElement("a"); - patterns_doc_link.href = patterns_doc_url; - patterns_doc_link.innerText = "here"; - const msg = document.createElement("span"); - msg.prepend(`'${pattern}' is not a valid URL pattern. See `, - patterns_doc_link, " for more details."); - throw msg; - } + for (let pattern of url_patterns) { + pattern = validate_normalize_url_pattern(pattern); if (pattern in payloads) throw `Pattern '${pattern}' specified multiple times!`; |