This commit is contained in:
Oleg Korobenko 2026-03-28 20:26:21 +01:00 committed by GitHub
commit 03adcba598
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -543,7 +543,9 @@ export default class SyncManager {
break;
}
case "delete_remote": {
newTreeFiles[action.filePath].sha = null;
if (newTreeFiles[action.filePath]) {
newTreeFiles[action.filePath].sha = null;
}
break;
}
case "download":
@ -858,7 +860,18 @@ export default class SyncManager {
// on them if it makes the plugin handle upload better on certain devices.
if (hasTextExtension(filePath)) {
const sha = await this.calculateSHA(filePath);
this.metadataStore.data.files[filePath].sha = sha;
if (this.metadataStore.data.files[filePath]) {
this.metadataStore.data.files[filePath].sha = sha;
} else {
this.metadataStore.data.files[filePath] = {
path: filePath,
sha: sha,
dirty: false,
justDownloaded: false,
lastModified: syncTime,
deleted: false,
};
}
return;
}
@ -875,7 +888,18 @@ export default class SyncManager {
treeFiles[filePath].sha = sha;
// Can't have both sha and content set, so we delete it
delete treeFiles[filePath].content;
this.metadataStore.data.files[filePath].sha = sha;
if (this.metadataStore.data.files[filePath]) {
this.metadataStore.data.files[filePath].sha = sha;
} else {
this.metadataStore.data.files[filePath] = {
path: filePath,
sha: sha,
dirty: false,
justDownloaded: false,
lastModified: syncTime,
deleted: false,
};
}
}),
);