EPUB: set content type for cover blob

Although the type can often be auto-detected, it's better to set it
explicitly, especially for SVGs.
This commit is contained in:
John Factotum
2022-10-21 10:20:23 +00:00
committed by GitHub
parent f39d74f932
commit 9250f47058
+5 -3
View File
@@ -689,9 +689,11 @@ export class EPUB {
else this.metadata[key] = [value] else this.metadata[key] = [value]
})) }))
this.getCover = () => { this.getCover = async () => {
const href = this.resources?.cover?.href const cover = this.resources?.cover
return href ? this.loadBlob(href) : null return cover?.href
? new Blob([await this.loadBlob(cover.href)], { type: cover.mediaType })
: null
} }
return this return this
} }