If you happen to have selected a given image for the OG image thumbnail, and then delete that image, OG Meta does not automatically purge that URL from its table. More than a small annoyance, this can cause subsequent node saves to mysteriously fail validation because the image loaded from the OG table does not exist in the set of options presented.
Here's a patch implementing the node_presave hook to harvest the images before saving, and compare to the values that OG Meta has stored. Because of the nature of the node object on save you generally won't get the full file object, but just a stub with the FID. For that reason the harvest_images method will load any files / fields where an FID is present, but a filemime is not, in an attempt to compare them properly.
I've included the code for the D6 version here as well, but have only tested in D7.
Comment | File | Size | Author |
---|---|---|---|
opengraph_meta-deleted-image-validation.patch | 3.36 KB | mshick |
Comments
Comment #1
drakythe CreditAttribution: drakythe commentedMinor issue with this patch. It works fine on its own (in my admittedly minor testing) andopengraph_meta is fine. However when used in conjunction with Webform and the File upload field of Webform, you end up with this:
This is fairly easy to replicate:
Comment #2
DaneMacaulay CreditAttribution: DaneMacaulay commentedTested and works as expected.
RTBC
Comment #2.0
DaneMacaulay CreditAttribution: DaneMacaulay commentedUpdating grammar