This commit is contained in:
Esmodea Burk 2025-09-19 18:03:09 +00:00 committed by GitHub
commit 7230b9a44b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -156,7 +156,7 @@ export function arrayBufferToBase64(buffer: ArrayBuffer): string {
}
export function base64ToArrayBuffer(base64: string): ArrayBuffer {
return Buffer.from(base64, "base64");
return Buffer.from(base64, "base64").buffer;
}
// Mock Event reference

View file

@ -261,7 +261,7 @@ export default class SyncManager {
}
const normalizedPath = normalizePath(targetPath);
await this.vault.adapter.writeBinary(normalizedPath, data);
await this.vault.adapter.writeBinary(normalizedPath, data.buffer);
await this.logger.info("Written file", {
normalizedPath,
});
@ -724,12 +724,12 @@ export default class SyncManager {
}
}
// For non-deletion cases, if SHAs differ, we just need to check if local changed.
// For non-deletion cases, if SHAs differ, we need to check if local changed and what file was modified last
// Conflicts are already filtered out so we can make this decision easily
if (localSHA !== localFile.sha) {
if (localSHA !== localFile.sha && remoteFile.lastModified < localFile.lastModified) {
actions.push({ type: "upload", filePath: filePath });
return;
} else {
} else if(remoteFile.lastModified > localFile.lastModified) {
actions.push({ type: "download", filePath: filePath });
return;
}