From 3f2dec6c4707d45bfaf045c31df7bdeb1971b994 Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 30 Oct 2026 19:47:20 +0100 Subject: [PATCH] place-contrib: sort the request id's parts with an explicit code-unit compare --- server/src/nest/place-contrib/place-contrib.helpers.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/nest/place-contrib/place-contrib.helpers.ts b/server/src/nest/place-contrib/place-contrib.helpers.ts index adb391208..7eea3eb7d 100644 --- a/server/src/nest/place-contrib/place-contrib.helpers.ts +++ b/server/src/nest/place-contrib/place-contrib.helpers.ts @@ -133,9 +133,12 @@ export function baseHashOf(value: string | null | undefined): string | null { * retry after a lost answer is recognised as the same contribution, and new * as soon as one of them was replaced. */ +/** Plain code-unit order: the same on every server, where a locale's collation is not. */ +const byCodeUnit = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0); + export function requestCid(entryCids: readonly string[]): string { const digest = createHash('sha256') - .update([...entryCids].sort().join(',')) + .update([...entryCids].sort(byCodeUnit).join(',')) .digest('base64url'); return digest.slice(0, 32); }