We’ve had quite a few reports on PNG’s failing image uploads on our install at v1.9.0.beta15 +27. It seems to only be certain PNG’s and not just based on size. It is particularly unfortunate for us because it now fails on the screenshots of a game the forum is based on, so many users are finding the issue. It has only recently started to happen (my guess would be around the Rails 5 or so update for 1.9, but not sure).
If we put the setting ‘png to jpg quality’ to 100 to disable it then we can get the images uploaded. The big downside of that is that we really liked the jpg rendering for the large topics that get posted rendering speed.
They are screenshots generated from Digital Combat Simulator. The subject of a lot of our forum content is this PC sim, plus the community post screenshots (which makes us converting them not possible, as discourse was doing it before this):
I’ve reported the issue at their site, but I do not know if it will be addressed. The format has obviously changed, as we’ve been ok the last 3 years or so. The users are confused, as the PNGs render ok in OSX/Windows, but only fail when uploading to our forum.
Thanks Jeff. There’s a link in the OP to a zip with the image in it.
After some further digging, I can confirm this is not a Discourse specific bug. It happens on Twitter uploads as well, and is game/sim screenshot dependent. The images the sim is now creating for screenshots are missing “end of image = IEND” chunk info. I’ve reported it to them and will do the ‘Png to jpg’ setting to 100 as a workaround on our forum.
If anything, I suppose this bug report could be a request to make the Discourse error surface to the user if it finds one? As in, if the upload fails with an imagemagick exception like that then let the end user know that the image was corrupt and the upload is not taking place.
@zogstrip looks like we are getting a 500 status code here and the error handler is unable to handle the error cause no json is being sent back.
This is happening cause there is an unhandled exception internally. (uploader should handle all of them and return proper errors)
We should probably add some “safeguard” just in case error handling to the js side of thing, eg: if you don’t have an error message display a simple “something went wrong” - like network went down mid request, random 503 and so on.