Problem with avatars and attachments in IE after installing 2.0.6

Started by WimB, October 27, 2013, 03:25:04 PM

Previous topic - Next topic

GL700Wing

Quote from: Arantor on November 01, 2013, 12:21:20 AM
I got no idea why they're failing in the first place ;)
My forum users have also experienced the same issues with IE not always displaying images since the upgrade to 2.0.6 and commenting out the following line in index.php fixed the issue in a few posts I checked:
header('X-Content-Type-Options: nosniff');

After reading this thread (and 2.0.6 upgrade - simple portal block issue) I did a bit of Googling and found the following: IE9 and IE10 does not display CAPTCHA image sometimes and JIRA will not display images with the wrong MIME type in IE due to nosniff header

Based on the information in the these two posts about the issue relating to the incorrect MIME type I then checked the value of 'mime_type' in the 'smf_attachment's table for the images that would not display with 'nosniff' enabled and discovered that it was empty.  As the images were 'jpg' images I updated the 'mime_type' field with the value 'image/jpeg' (and re-enabled 'nosniff' in index.php) and after refreshing the page the images displayed!

I then ran the following SQL commands against my database (after making a backup first!) for the different image types and IE is now behaving itself!

UPDATE `smf_attachments` SET `mime_type` = 'image/bmp' WHERE `fileext` = 'bmp' AND `mime_type` = '';
UPDATE `smf_attachments` SET `mime_type` = 'image/gif' WHERE `fileext` = 'gif' AND `mime_type` = '';
UPDATE `smf_attachments` SET `mime_type` = 'image/jpeg' WHERE `fileext` = 'jpg' AND `mime_type` = '';
UPDATE `smf_attachments` SET `mime_type` = 'image/png' WHERE `fileext` = 'png' AND `mime_type` = '';
Life doesn't have to be perfect to be wonderful ...

Arantor

Ahhhh, that makes sense, though that should primarily only affect 1.1.x (which doesn't store the MIME type) and early 2.0 (which also didn't), but that does mean it is something the upgrader should fix.

As far as the CAPTCHA goes, it should always be issued with the correct header?
No good deed goes unpunished / All helpful urges should be circumvented

I have something to say: it's better to burn out than to fade away. There can be only one.

GL700Wing

Quote from: Arantor on November 06, 2013, 08:08:03 AM
Ahhhh, that makes sense, though that should primarily only affect 1.1.x (which doesn't store the MIME type) and early 2.0 (which also didn't), ...
I only upgraded from 1.1.18 to 2.0.4 a few months ago and I noticed when I checked the 1.1.18 database a short time ago that the 'mime_type' field wasn't in the 'smf_attachments' table - I figure you'd know when it was introduced to 2.0.  Only recent attachments had the 'mime_type' field populated in the 'smf_attachments' table in my 2.0.6 database.

Quote from: Arantor on November 06, 2013, 08:08:03 AM
... but that does mean it is something the upgrader should fix.
Does that mean I should also set the 'mime_type' for all attachment types (eg, pdf, txt, zip. etc)?

Quote from: Arantor on November 06, 2013, 08:08:03 AM
As far as the CAPTCHA goes, it should always be issued with the correct header?
I don't know - I don't use CAPTCHA.  I only used that link as a reference because it helped me understand the cause of the issue.
Life doesn't have to be perfect to be wonderful ...

Arantor

QuoteDoes that mean I should also set the 'mime_type' for all attachment types (eg, pdf, txt, zip. etc)?

It really matters for images, but isn't so important for the non image types. I forget whether SMF itself even bothers for those.
No good deed goes unpunished / All helpful urges should be circumvented

I have something to say: it's better to burn out than to fade away. There can be only one.

GL700Wing

Quote from: Arantor on November 06, 2013, 08:46:10 AM
QuoteDoes that mean I should also set the 'mime_type' for all attachment types (eg, pdf, txt, zip. etc)?

It really matters for images, but isn't so important for the non image types. I forget whether SMF itself even bothers for those.
Thanks for the info - I won't worry about updating the MIME type for non-image file types at this time.
Life doesn't have to be perfect to be wonderful ...

Scott Hamilton

Quote from: GL700Wing on November 06, 2013, 07:34:38 AM
Quote from: Arantor on November 01, 2013, 12:21:20 AM
I got no idea why they're failing in the first place ;)
My forum users have also experienced the same issues with IE not always displaying images since the upgrade to 2.0.6 and commenting out the following line in index.php fixed the issue in a few posts I checked:
header('X-Content-Type-Options: nosniff');

After reading this thread (and 2.0.6 upgrade - simple portal block issue) I did a bit of Googling and found the following: IE9 and IE10 does not display CAPTCHA image sometimes and JIRA will not display images with the wrong MIME type in IE due to nosniff header

Based on the information in the these two posts about the issue relating to the incorrect MIME type I then checked the value of 'mime_type' in the 'smf_attachment's table for the images that would not display with 'nosniff' enabled and discovered that it was empty.  As the images were 'jpg' images I updated the 'mime_type' field with the value 'image/jpeg' (and re-enabled 'nosniff' in index.php) and after refreshing the page the images displayed!

I then ran the following SQL commands against my database (after making a backup first!) for the different image types and IE is now behaving itself!

UPDATE `smf_attachments` SET `mime_type` = 'image/bmp' WHERE `fileext` = 'bmp' AND `mime_type` = '';
UPDATE `smf_attachments` SET `mime_type` = 'image/gif' WHERE `fileext` = 'gif' AND `mime_type` = '';
UPDATE `smf_attachments` SET `mime_type` = 'image/jpeg' WHERE `fileext` = 'jpg' AND `mime_type` = '';
UPDATE `smf_attachments` SET `mime_type` = 'image/png' WHERE `fileext` = 'png' AND `mime_type` = '';

Wow, GL700Wing- this worked great! I ran you query's on my db and everything is working correctly again. Thank you!

Been running the software since the YaBBSE days.. Had this issue for a while now and could not figure it out, you are the man.

Scott
Been with SMF since the YabbSE Days...
http://www.fordpinto.com

Advertisement: