Photo: drop fileSize, exif() throws without a content cache
check / check (push) Successful in 1m58s
check / check (push) Successful in 1m58s
Remove fileSize from Photo, PhotoRecord, README and TODO.md: the server's
value is the size of the encrypted file, not the original's.
exif() now checks for the content cache before it returns {} for a video,
so it throws like original(), thumbnail() and content() when the library
has no content source. README names the methods that also serve an
original from the backup, since thumbnail() does not.
New tests: exif() on a JPEG whose EXIF block cannot be parsed returns {},
and exif() on a video throws without a content source.
Model: opus-5-5
This commit is contained in:
+3
-4
@@ -82,9 +82,6 @@ export class Photo {
|
||||
get hash(): string | undefined {
|
||||
return this.rec.hash;
|
||||
}
|
||||
get fileSize(): number | undefined {
|
||||
return this.rec.fileSize;
|
||||
}
|
||||
get isArchived(): boolean {
|
||||
return this.rec.isArchived;
|
||||
}
|
||||
@@ -132,8 +129,10 @@ export class Photo {
|
||||
|
||||
// The common EXIF fields of the original, read from `content()`, so this
|
||||
// may download it. Only a JPEG's EXIF is read; any other file gives `{}`,
|
||||
// and a video gives it without fetching anything.
|
||||
// and a video gives it without fetching anything. Like the other content
|
||||
// methods, it throws when there is no content cache, video or not.
|
||||
async exif(opts?: ContentOptions): Promise<PhotoExif> {
|
||||
this.cacheOrThrow();
|
||||
if (this.rec.fileType === "video") return {};
|
||||
return readPhotoExif(await this.content(opts));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user