From a5d14d16cded936589def554664284e4430fe9fe Mon Sep 17 00:00:00 2001 From: HexaField Date: Fri, 21 Jun 2024 17:54:02 +1000 Subject: [PATCH] fix resources.json sorting not happening when it is regenerated --- .../src/media/static-resource/static-resource-helper.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/server-core/src/media/static-resource/static-resource-helper.ts b/packages/server-core/src/media/static-resource/static-resource-helper.ts index fa6f134dd7..a3d649e7c7 100644 --- a/packages/server-core/src/media/static-resource/static-resource-helper.ts +++ b/packages/server-core/src/media/static-resource/static-resource-helper.ts @@ -225,8 +225,14 @@ export const regenerateProjectResourcesJson = async (app: Application, projectNa ]) ) + const sortedResourcesJson = Object.fromEntries( + Object.entries(resourcesJson).sort(([a], [b]) => { + return a.localeCompare(b) + }) + ) + const key = `projects/${projectName}/resources.json` - const body = Buffer.from(JSON.stringify(resourcesJson, null, 2)) + const body = Buffer.from(JSON.stringify(sortedResourcesJson, null, 2)) const storageProvider = getStorageProvider()