Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(docsync): sort Papra's enumeration digest with an explicit comparator

Maurice66061a05df21
diff --git a/server/src/nest/doc-sync/providers/papra.provider.ts b/server/src/nest/doc-sync/providers/papra.provider.ts
index d2014efd4..51d295237 100644
--- a/server/src/nest/doc-sync/providers/papra.provider.ts
+++ b/server/src/nest/doc-sync/providers/papra.provider.ts
@@ -350,7 +350,9 @@ function inScope(doc: PapraDocument, tagId: string, serverFiltered: boolean): bo
* complete set rather than from the newest entry.
*/
function enumerationDigest(documents: RemoteDocument[]): string {
- const pairs = documents.map((doc) => `${doc.remoteId}:${doc.remoteVersion}`).sort();
+ const pairs = documents
+ .map((doc) => `${doc.remoteId}:${doc.remoteVersion}`)
+ .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
return crypto.createHash('sha256').update(pairs.join('\n')).digest('hex');
}