I'm running into some issues where corrupt images are being uploaded and saved. The images have the proper image header, and so they validate on the image_get_info_call(), but fail if anything tries to actually open the image. We should validate that an image can be loaded before saving a node with it.

Comments

deviantintegral’s picture

Status: Active » Needs review
StatusFileSize
new9.76 KB

Here's a patch that contains the following two commits:

  • 44e4bc0 Issue #1410588: Validate images before saving a node.
  • 30b37be Issue #1410588: Show any errors returned when uploading images.

There is certainly some cleanup that could be done as a part of the error handling. Specifically, die() should be removed and proper HTTP error status codes should be used. I think it's reasonable to handle those as a part of a separate issue.

This patch isn't needed for the 7.x-1.x branch as the D7 module doesn't create nodes at all.

deviantintegral’s picture

StatusFileSize
new11.34 KB

Here's an additional commit that logs the browser and runtime to the watchdog when a corrupted image is detected.