-
Notifications
You must be signed in to change notification settings - Fork 53
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
Make image format detection and SvgImageFile
initialisation more robust
#144
Comments
@zerolab It would be helpful to have an image file that causes this bug. |
Yeah.. I have been trying.. https://wagtailcms.slack.com/archives/C81FGJR2S/p1709908265029289 I suspect they are uploading images without an extension, and then there's potentially something with the system that |
OK, so finally got confirmation. It was images without an extension, so Lines 86 to 87 in 830aa3d
|
SvgImageFile
initialisation more robust when provided a malformed SVGSvgImageFile
initialisation more robust
Honestly - does it matter if we have a file that fails? I thought he mentioned there was a file extension visible in the database. (his examples also show extension) We should probably fallback on extensions after checking the mimetype; and then try to guess if it's SVG, no? Seems like a generally good improvement to me. |
We have a custom model inheriting from
When I upload an image I get the following error:
Which is weird as I am uploading a png or jpeg image.I tried different images on different environments so this issue is not arising from a corrupted image file. After further investigation and @zerolab and @Nigel2392 think the problem is arising when willow is guessing the wrong file type /extension in Lines 86 to 87 in 830aa3d
The code blame shows that this part of the code was added last year. I am upgrading from Wagtail 4.2 to Wagtail 5, which would explain why it never occurred before. When I run the following:
I get My guess is that it is unable to guess the correct file type for the BLOB when opening a file from gcloud storage. |
I still get the issue even if the |
Hi, I am doing some more investigation and here's my findings
When I try to get the path I get unimplemented error, which is understandable as it is being read from Gcloud into a temp fle:
Does that mean that the |
Just an update, I was able to solve the issue by making changes to the storage class. The package I was using was downloading the image file from Gcloud and using a I changed it o use a May be someone can add compatibility in Willow for But thanks for all your time and help. Really appreciate it. |
https://pastebin.com/jNWdCZ2N
Update: the issue seems to be with
Willow/willow/image.py
Lines 82 to 99 in 830aa3d
Willow/willow/image.py
Lines 86 to 87 in 830aa3d
The text was updated successfully, but these errors were encountered: