-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
fix(previews): Don't crash on animated WEBP images #38364
fix(previews): Don't crash on animated WEBP images #38364
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Why not just create a preview provider to do this magic? OC_Image is one of those classes that still needs to die IMO. |
Well yeah (#28279 et al + Imaginary support etc), but this PR just fixes what is still a common/still supported setup (particularly in small deployments). P.S. Is there an official deprecation of OC_Image preview generation? I thought it fell more into the category "we know it's coming, things are happening to build up to it, but not yet deprecated" 👀 |
WebP preview provider: https://github.com/nextcloud/server/blob/master/lib/private/Preview/WebP.php Currently the generic implementation, using OC_Image, is used to generate previews for WebP. |
510ca8a
to
edf8ca6
Compare
This comment was marked as resolved.
This comment was marked as resolved.
@ytoaa Can you elaborate? What are you experiencing when you're testing this PR doing in your environment? |
edf8ca6
to
7943ad6
Compare
Oh I think I'm mistaken. When will this merge into the main release? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works. Didn't have a look at the code though.
To be honest, I don't like rawdogging the decoder logic but I don't see a better way for now.
@joshtrichards Please squash and use a conventional commit message. E.g. |
8cc107f
to
cff4727
Compare
/backport to stable29 |
/backport to stable28 |
bc97193
to
e2aaf27
Compare
Fixes nextcloud#30029 and nextcloud#37263 libgd handles animated WEBP images poorly and generates a meaningless error message as a result. We were returning a 500 error for these preview requests (web) and a fatal error at the command-line (occ). Now we bypass libgd if the we detect an animated WEBP image (and simply don't generate the preview). No more 500 error. Should fix occ too. Signed-off-by: Josh Richards <josh.t.richards@gmail.com> Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
e2aaf27
to
046fe8d
Compare
I don't get why cypress keeps failing. Could this be because the action is run from a fork? |
Yes iirc our cypress setup does not support forks |
Alright, thanks for clarifying. @joshtrichards I'm sorry for the inconvenience but do you mind opening another PR from a branch on this repository directly? AFAIK, you should have permissions to do so. |
Summary
libgd handles animated WEBP images poorly (fatal error and generates a meaningless/misleading error message). As a result we were returning a 500 error for these
/preview
requests (web) and a fatal error at the command-line (occ
). Now we bypass libgd if we detect an animated WEBP image and simply don't generate the preview. No more 500 error. Should fixocc
too.The prospect of incorporating animation handling is an upstream matter:
libgd/libgd#648
https://bugs.php.net/bug.php?id=79809
https://www.php.net/manual/en/function.imagecreatefromwebp.php
TODO
Checklist