Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mwoffliner drops downloaded images from zim creation if imagemin toolchain fails processing them #1980

Open
cm8 opened this issue Feb 1, 2024 · 0 comments

Comments

@cm8
Copy link

cm8 commented Feb 1, 2024

} else {
resp.data = await (imagemin as any).buffer(resp.data, imageminOptions.get('default').get(resp.headers['content-type'])).catch(() => {
return resp.data
})
}
return true
}
return false
}
private getContentCb = async (url: string, handler: any): Promise<void> => {
logger.info(`Downloading [${url}]`)
try {
if (this.optimisationCacheUrl && isImageUrl(url)) {
this.downloadImage(url, handler)
} else {
const resp = await axios(url, this.arrayBufferRequestOptions)
await this.getCompressedBody(resp)

The catch in line 505 seems to miss an error handler: If the imagemin call fails, then a successfully downloaded image will be dropped from ZIM creation. mwoffliner can do better in these cases: if the size reduction fails, log and take the downloaded original.


As an example for a possibly failing image see
https://upload.wikimedia.org/wikipedia/commons/thumb/1/1e/Schleiflade_Tontraktur_Animation.gif/120px-Schleiflade_Tontraktur_Animation.gif

Prior to kohler/gifsicle@0e02f7b this file would fail a gifsicle run and thus not be included in any zim even if the resource successfully downloaded..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant