Allow backfill for more undownloadable attachments

This commit is contained in:
Fedor Indutny 2025-03-26 11:48:28 -07:00 committed by GitHub
commit 427f91f903
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 98 additions and 49 deletions

View file

@ -17,6 +17,7 @@ import {
mightBeOnBackupTier,
type AttachmentType,
AttachmentVariant,
AttachmentPermanentlyUndownloadableError,
} from '../types/Attachment';
import * as Bytes from '../Bytes';
import {
@ -115,9 +116,13 @@ export async function downloadAttachment(
const { digest, incrementalMac, chunkSize, key, size } = attachment;
strictAssert(digest, `${logId}: missing digest`);
strictAssert(key, `${logId}: missing key`);
strictAssert(isNumber(size), `${logId}: missing size`);
try {
strictAssert(digest, `${logId}: missing digest`);
strictAssert(key, `${logId}: missing key`);
strictAssert(isNumber(size), `${logId}: missing size`);
} catch (error) {
throw new AttachmentPermanentlyUndownloadableError(error.message);
}
const mediaTier =
options?.mediaTier ??