From b67a11bf764bc1ae2165a295610641b1eac40220 Mon Sep 17 00:00:00 2001 From: Hans Baker Date: Mon, 4 Nov 2024 03:45:50 -0800 Subject: [PATCH] Fix regex expressions - anchors not being respected (#1211) Regexs like `/^a|b|c$/` match `a` at start of text, `c` at end of text, or `b`. I assume this does not match the author's original intent --- src/js/constants.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/constants.js b/src/js/constants.js index 4f85d60d9..32da6235c 100644 --- a/src/js/constants.js +++ b/src/js/constants.js @@ -57,10 +57,10 @@ export const EVENT_ZOOM = 'zoom'; export const MIME_TYPE_JPEG = 'image/jpeg'; // RegExps -export const REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/; +export const REGEXP_ACTIONS = /^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/; export const REGEXP_DATA_URL = /^data:/; export const REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/; -export const REGEXP_TAG_NAME = /^img|canvas$/i; +export const REGEXP_TAG_NAME = /^(img|canvas)$/i; // Misc // Inspired by the default width and height of a canvas element.