wagtail-wordpress-import icon indicating copy to clipboard operation
wagtail-wordpress-import copied to clipboard

`get_or_save_image` can fail if the downloaded image's is corrupted

Open fabienheureux opened this issue 4 years ago • 2 comments

This image https://limonadier.net/wp-content/uploads/2019/09/IMG_1782.jpg appears to be corrupted, but returns a 200 in get_or_save_image function.

This causes django to raise an integrity error because its width is 0 pixel

psycopg2.errors.NotNullViolation: null value in column "width" of relation "wagtailimages_image" violates not-null constraint

IMG_1782

fabienheureux avatar Jan 22 '22 08:01 fabienheureux

Here is a potential fix https://github.com/torchbox/wagtail-wordpress-import/pull/146 (still in draft)

Let me know what you think of this approach

fabienheureux avatar Jan 22 '22 10:01 fabienheureux

The example image seems to be unavailable now.

If you can complete the PR I'd be happy to review it. Thanks

nickmoreton avatar Jan 27 '22 15:01 nickmoreton