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] 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}`; }