From 222350530050d059f461b30ce04dcf265969bee4 Mon Sep 17 00:00:00 2001 From: Boegie19 <34578426+Boegie19@users.noreply.github.com> Date: Sun, 10 Mar 2024 12:58:36 +0100 Subject: [PATCH 1/2] generateCacheKey.js --- .../server/utils/keys/generateCacheKey.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/strapi-plugin-rest-cache/server/utils/keys/generateCacheKey.js b/packages/strapi-plugin-rest-cache/server/utils/keys/generateCacheKey.js index dcaba29a6..dc26cf8df 100644 --- a/packages/strapi-plugin-rest-cache/server/utils/keys/generateCacheKey.js +++ b/packages/strapi-plugin-rest-cache/server/utils/keys/generateCacheKey.js @@ -23,10 +23,7 @@ function generateCacheKey( headersSuffix = generateHeadersKey(ctx, keys.useHeaders); } - const requestPath = toLower(path.normalize(ctx.request.path)).replace( - /\/$/, - '' - ); + const requestPath = toLower(ctx.request.path); return `${requestPath}?${querySuffix}&${headersSuffix}`; } From f2c7c3610b21de5cae00d7ea4656c32e6dd78c96 Mon Sep 17 00:00:00 2001 From: Boegie19 <34578426+Boegie19@users.noreply.github.com> Date: Tue, 12 Mar 2024 22:22:25 +0100 Subject: [PATCH 2/2] always use posix and not switch depending on operating system --- .../server/utils/keys/generateCacheKey.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/strapi-plugin-rest-cache/server/utils/keys/generateCacheKey.js b/packages/strapi-plugin-rest-cache/server/utils/keys/generateCacheKey.js index dc26cf8df..02e0ffff5 100644 --- a/packages/strapi-plugin-rest-cache/server/utils/keys/generateCacheKey.js +++ b/packages/strapi-plugin-rest-cache/server/utils/keys/generateCacheKey.js @@ -23,7 +23,10 @@ function generateCacheKey( headersSuffix = generateHeadersKey(ctx, keys.useHeaders); } - const requestPath = toLower(ctx.request.path); + const requestPath = toLower(path.posix.normalize(ctx.request.path)).replace( + /\/$/, + '' + ); return `${requestPath}?${querySuffix}&${headersSuffix}`; }