This commit is contained in:
Andras Schmelczer 2024-12-20 18:40:09 +00:00
commit 395b8b6784
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C

View file

@ -45,8 +45,8 @@ export async function syncLocallyUpdatedFile({
);
}
const contentBytes = await operations.read(relativePath),
contentHash = hash(contentBytes);
const contentBytes = await operations.read(relativePath);
const contentHash = hash(contentBytes);
if (metadata.hash === contentHash && oldPath !== undefined) {
history.addHistoryEntry({
@ -91,6 +91,7 @@ export async function syncLocallyUpdatedFile({
}
const responseBytes = lib.base64_to_bytes(response.contentBase64);
const responseHash = hash(responseBytes);
if (response.relativePath != relativePath) {
await waitForDocumentLock(response.relativePath);
@ -116,7 +117,7 @@ export async function syncLocallyUpdatedFile({
} finally {
unlockDocument(response.relativePath);
}
} else {
} else if (contentHash !== responseHash) {
await operations.write(relativePath, contentBytes, responseBytes);
}
@ -125,7 +126,7 @@ export async function syncLocallyUpdatedFile({
oldRelativePath: oldPath ?? relativePath,
relativePath: response.relativePath,
parentVersionId: response.vaultUpdateId,
hash: contentHash,
hash: responseHash,
});
} catch (e) {
history.addHistoryEntry({