API refinements

This commit is contained in:
Zef Hemel
2023-08-15 20:15:27 +02:00
parent 5cf97272c1
commit 7cce83b240
4 changed files with 21 additions and 7 deletions
+10 -1
View File
@@ -245,6 +245,16 @@ export class SyncService {
}
try {
remoteHash = (await this.remoteSpace!.getFileMeta(name)).lastModified;
if (!remoteHash) {
console.info(
"Not syncing file, because remote didn't send X-Last-Modified header",
);
// This happens when the remote isn't a real SilverBullet server, specifically: it's not sending
// a X-Last-Modified header. In this case we'll just assume that the file is up to date.
await this.registerSyncStop(false);
// Jumping out, not saving snapshot nor triggering a sync event, because we did nothing
return;
}
} catch (e: any) {
if (e.message === "Not found") {
// File doesn't exist remotely, that's ok
@@ -264,7 +274,6 @@ export class SyncService {
}
await this.saveSnapshot(snapshot);
await this.registerSyncStop(false);
// console.log("And done with file sync for", name);
}
async saveSnapshot(snapshot: Map<string, SyncStatusItem>) {