From dad0c361f595b4644bb553170ff6970506166796 Mon Sep 17 00:00:00 2001 From: monsieurswag Date: Fri, 17 May 2024 12:05:23 +0200 Subject: [PATCH] URNs containing whitespaces will now be considered invalid --- backend/library/utils.py | 2 +- frontend/src/lib/utils/constants.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/library/utils.py b/backend/library/utils.py index a9be619fd..464d1924d 100644 --- a/backend/library/utils.py +++ b/backend/library/utils.py @@ -28,7 +28,7 @@ logger = structlog.get_logger(__name__) -URN_REGEX = r"^urn:([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)(?::([a-zA-Z0-9_-]+))?:(.+)$" +URN_REGEX = r"^urn:([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)(?::([a-zA-Z0-9_-]+))?:(\S+)$" def match_urn(urn_string): diff --git a/frontend/src/lib/utils/constants.ts b/frontend/src/lib/utils/constants.ts index 8c57cda78..df3a93e92 100644 --- a/frontend/src/lib/utils/constants.ts +++ b/frontend/src/lib/utils/constants.ts @@ -37,7 +37,7 @@ export const UUID_REGEX = '([0-9a-f]{8}\\-[0-9a-f]{4}\\-[0-9a-f]{4}\\-[0-9a-f]{4 export const UUID_LIST_REGEX = new RegExp(`^${UUID_REGEX}(,${UUID_REGEX})*$`); export const URN_REGEX = - /^urn:([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)(?::([a-zA-Z0-9_-]+))?:(.+)$/; + /^urn:([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)(?::([a-zA-Z0-9_-]+))?:(\S+)$/; export const LOCALE_DISPLAY_MAP = { en: '🇬🇧 English',