CR2 raw files are being treated as tiff files

This is just for tracking the issue. The bug is actually in fastimage and reported here:

https://github.com/sdsykes/fastimage/issues/104

Directly to the twitter discussion about the issue

If the bug is in fastimage then it is not a bug in Discourse…

Raw file full on support is going to have to be plugin area. In general these files are 10-30 megs and dealing with them is quite a nightmare cause we would need http://www.cybercom.net/~dcoffin/dcraw/ in our image and in general even photographers do not like sharing raw files which are usually considered “my private blueprint”

That said…

We recently introduced a fix that looks at the actual contents of files prior to treating them as an image. This happened cause gravatar did not care about file extensions and would return jpegs as png so we went all atomic now and “coerce” images to correct file types.

raw files tend to “look” like tiff files cause they tend to use a tiff container. This does not really matter to us anyway cause the “image extension correction” should only apply to png/jpeg/gif… everything else really should be treated as attachments and not pass through file extension coercion.

I think we should narrow down “supported images” down here:

https://github.com/discourse/discourse/blob/master/lib/file_helper.rb#L106

tif / tiff / webp should be removed due to uneven browser support and simply treated as attachments. see:

Chrome has no support for tif, not-chrome has no support for webp.

9 Likes

I removed tiff and tif from the list and it actually works as we want. I
think I will patch that in our package for now.

2 Likes

Do we even need .bmp there while we are at it?

4 Likes

fastimage now skips raw files:

https://github.com/sdsykes/fastimage/issues/104#event-1834709521

I asked for a release.

5 Likes

Really not sure, technically there is cross browser support, but yeah lightboxing a bmp makes little sense and I can no see any kind of scenario where you would want a bmp as a site asset (ico though we do render so I don’t want to play with the pipeline for it)

4 Likes

New release out fastimage | RubyGems.org | your community gem host

removed my discourse-skip-tiff.patch and ran discourse with fastimage 2.1.4. Works nicely.

So can we get the changes for the 2.1.0 release?

  1. push fastimage 2.1.4 update
  2. removing tif* + bmp from the list
3 Likes

tif support is now dropped which is good and tif is simply treated same as cr2, as a binary which is attached.

https://github.com/discourse/discourse/blob/42340583582c11d4acc3008f36ad91cbfec279c6/lib/file_helper.rb#L103-L105

4 Likes

This topic was automatically closed after 3 days. New replies are no longer allowed.