Back up from a copy that decrypted even outside a run's albums; README wording
A file whose copy in an album in scope does not decrypt is now backed up from a copy that decrypted in any album, not only one in scope; with no such copy it is still recorded as failed. The README now says the exit code stays at 1 until the server sends a copy that decrypts or deletes it, and that only a run without --json prints the FAILED album line. StoredMetadata.undecryptable is required, like the other fields. Model: opus-5-5
This commit is contained in:
+15
-13
@@ -609,9 +609,9 @@ const runLockedBackup = async (
|
||||
|
||||
// What the library could not decrypt. An album is logged by its ID, as
|
||||
// its name is not known, so a run limited to some albums logs it too. A
|
||||
// file in an album in scope is recorded as failed, with an empty title as
|
||||
// its metadata is not known, unless a copy of it in another album
|
||||
// decrypted.
|
||||
// file in an album in scope is backed up from a copy of it in another
|
||||
// album that decrypted, even an album out of scope. With no such copy it
|
||||
// is recorded as failed, with an empty title as its metadata is not known.
|
||||
const scope = new Set(collections.map((c) => c.id));
|
||||
const undecryptableAlbums: number[] = [];
|
||||
for (const record of lib.undecryptable()) {
|
||||
@@ -619,16 +619,18 @@ const runLockedBackup = async (
|
||||
if (record.fileID === undefined) {
|
||||
log(`FAILED album ${record.collectionID}: ${error}`);
|
||||
undecryptableAlbums.push(record.collectionID);
|
||||
} else if (
|
||||
scope.has(record.collectionID) &&
|
||||
!memberships.has(record.fileID)
|
||||
) {
|
||||
recordFailure(
|
||||
record.fileID,
|
||||
"",
|
||||
collectionName.get(record.collectionID) ?? "",
|
||||
new Error(error),
|
||||
);
|
||||
} else if (scope.has(record.collectionID)) {
|
||||
const copies = memberships.get(record.fileID);
|
||||
if (copies) {
|
||||
distinct.set(record.fileID, representative(copies));
|
||||
} else {
|
||||
recordFailure(
|
||||
record.fileID,
|
||||
"",
|
||||
collectionName.get(record.collectionID) ?? "",
|
||||
new Error(error),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ interface StoredMetadata {
|
||||
collectionsSinceTime: Microseconds;
|
||||
collections: StoredCollection[];
|
||||
files: StoredFile[];
|
||||
undecryptable?: Undecryptable[];
|
||||
undecryptable: Undecryptable[];
|
||||
}
|
||||
|
||||
const encodeKey = (key: Uint8Array): string =>
|
||||
|
||||
Reference in New Issue
Block a user