From 9250f4705837ccc2f695ba814439367237274c7e Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Fri, 21 Oct 2022 10:20:23 +0000 Subject: [PATCH] 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. --- epub.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/epub.js b/epub.js index 65763f3..1d0867d 100644 --- a/epub.js +++ b/epub.js @@ -689,9 +689,11 @@ export class EPUB { else this.metadata[key] = [value] })) - this.getCover = () => { - const href = this.resources?.cover?.href - return href ? this.loadBlob(href) : null + this.getCover = async () => { + const cover = this.resources?.cover + return cover?.href + ? new Blob([await this.loadBlob(cover.href)], { type: cover.mediaType }) + : null } return this }