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

Image can be None in construct_block function

Open fabienheureux opened this issue 3 years ago • 1 comments

In the construct_block function, the image variable can be None in some situations, hence failing when trying to access image.id. I have a suggestion of adding a try / except, in order to fail silently in this case : https://github.com/fabienheureux/wagtail-wordpress-import/commit/99bf46e02666283d06a6504db9acbf5e5f21fa4e

Any feedback welcome :+1:

fabienheureux avatar Jan 21 '22 08:01 fabienheureux

Thanks Fabien

Could it be simpler this way?

"image": image_file.id if image_file else None,

nickmoreton avatar Jan 27 '22 15:01 nickmoreton