One album or file quak cannot decrypt no longer stops a refresh or a backup (closes #181)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
A file or album whose key, metadata or name does not decrypt used to throw out of the refresh, so quak backup stopped before storing anything, every run. Client.collectionsSince and filesSince now return such a row in undecryptable with the reason, the refresh leaves it out, and the store keeps the list in metadata.json until a later refresh decrypts or deletes the record. lib.backup() records each such file in failures.json unless a copy in another album decrypted, in which case it stores the original from that copy. Each such album is listed in BackupResult.undecryptableAlbums and printed as one FAILED album line. quak backup exits 1 while either remains. An album or file that no longer decrypts loses its album folder, JSON and links; its original stays. Model: opus-5-5
This commit was merged in pull request #188.
This commit is contained in:
@@ -172,6 +172,29 @@ describe("MetadataStore", () => {
|
||||
expect(store.listCollections()).toEqual([]);
|
||||
});
|
||||
|
||||
it("loads an empty store when the list of what the refresh could not decrypt is damaged", async () => {
|
||||
// A backup reads that list on every run, so a damaged one that loaded
|
||||
// would fail every backup until the cache was deleted. A string is
|
||||
// damaged too, though JavaScript can loop over its characters.
|
||||
mkdirSync(join(dir, "cache"), { recursive: true });
|
||||
for (const undecryptable of [{}, "not a list", [1]]) {
|
||||
writeFileSync(
|
||||
path,
|
||||
JSON.stringify({
|
||||
schemaVersion: METADATA_SCHEMA_VERSION,
|
||||
userID: 42,
|
||||
collectionsSinceTime: 0,
|
||||
collections: [],
|
||||
files: [],
|
||||
undecryptable,
|
||||
}),
|
||||
);
|
||||
const store = await MetadataStore.load(path);
|
||||
expect(store.userID).toBe(0);
|
||||
expect(store.listUndecryptable()).toEqual([]);
|
||||
}
|
||||
});
|
||||
|
||||
it("creates the directory 0700 and the file 0600", async () => {
|
||||
const store = await MetadataStore.load(path);
|
||||
store.putCollection(sampleCollection());
|
||||
|
||||
Reference in New Issue
Block a user