From c20aba0b42482b4969e0abebf4c3cf39ab33dd47 Mon Sep 17 00:00:00 2001 From: jNullj <15849761+jNullj@users.noreply.github.com> Date: Tue, 23 Sep 2025 15:12:37 +0000 Subject: [PATCH 1/3] chore(deps): bump path-to-regexp from 6.3.0 to 8.3.0 --- package-lock.json | 13 +++++++++---- package.json | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6896634183dc5..80854a705b532 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ "node-env-flag": "^0.1.0", "node-pg-migrate": "^8.0.3", "parse-link-header": "^2.0.0", - "path-to-regexp": "^6.3.0", + "path-to-regexp": "^8.3.0", "pg": "^8.16.3", "priorityqueuejs": "^2.0.0", "prom-client": "^15.1.3", @@ -26077,9 +26077,14 @@ } }, "node_modules/path-to-regexp": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", - "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==" + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } }, "node_modules/path-type": { "version": "4.0.0", diff --git a/package.json b/package.json index 5c78b09d1a41a..f0d1ba3080f40 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "node-env-flag": "^0.1.0", "node-pg-migrate": "^8.0.3", "parse-link-header": "^2.0.0", - "path-to-regexp": "^6.3.0", + "path-to-regexp": "^8.3.0", "pg": "^8.16.3", "priorityqueuejs": "^2.0.0", "prom-client": "^15.1.3", From b82c7b5ac3e4f348a47e781804e7b09e3f6c8f3f Mon Sep 17 00:00:00 2001 From: jNullj <15849761+jNullj@users.noreply.github.com> Date: Tue, 23 Sep 2025 15:19:24 +0000 Subject: [PATCH 2/3] renamed `strict: true` to `trailing: false` --- core/base-service/route.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/base-service/route.js b/core/base-service/route.js index 7c497fc872eac..633170bccd993 100644 --- a/core/base-service/route.js +++ b/core/base-service/route.js @@ -36,7 +36,7 @@ function prepareRoute({ base, pattern, format, capture, withPng }) { const fullPattern = `${makeFullUrl(base, pattern)}:ext(${extensionRegex})` const keys = [] regex = pathToRegexp(fullPattern, keys, { - strict: true, + trailing: false, sensitive: true, }) captureNames = keys.map(item => item.name).slice(0, -1) From fa90feb4456b7893141698a22625b97fcc52c907 Mon Sep 17 00:00:00 2001 From: jNullj <15849761+jNullj@users.noreply.github.com> Date: Tue, 23 Sep 2025 16:40:10 +0000 Subject: [PATCH 3/3] update prepareRoute to inject extention regex outside of pathToRegexp context due to breaking changes in pathToRegexp that removed regex support --- core/base-service/route.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/base-service/route.js b/core/base-service/route.js index 633170bccd993..8c2e2053aa270 100644 --- a/core/base-service/route.js +++ b/core/base-service/route.js @@ -33,13 +33,19 @@ function prepareRoute({ base, pattern, format, capture, withPng }) { regex = new RegExp(`^${makeFullUrl(base, format)}(${extensionRegex})$`) captureNames = capture || [] } else { - const fullPattern = `${makeFullUrl(base, pattern)}:ext(${extensionRegex})` + const fullPatternWithoutExt = `${makeFullUrl(base, pattern)}` const keys = [] - regex = pathToRegexp(fullPattern, keys, { + const pathRegex = pathToRegexp(fullPatternWithoutExt, keys, { trailing: false, sensitive: true, }) - captureNames = keys.map(item => item.name).slice(0, -1) + const sourceWithoutEnd = pathRegex.regexp.source.replace(/\$$/, '') + // workaround for path-to-regexp not supporting regex anymore + regex = new RegExp( + `${sourceWithoutEnd}(${extensionRegex})$`, + pathRegex.regexp.flags, + ) + captureNames = keys.map(item => item.name) } return { regex, captureNames } }