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

SonarCloud flags a bare .sort() on strings (S2871). The comparator keeps
the byte order the default sort used, so every cursor already stored
stays valid.
This commit is contained in:
Maurice
2026-09-19 15:52:26 +02:00
parent bcdb931a34
commit 66061a05df
@@ -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');
}