Hard Light Productions Forums

Site Management => Site Support / Feedback => Topic started by: z64555 on November 22, 2011, 01:01:00 pm

Title: Attachment issues
Post by: z64555 on November 22, 2011, 01:01:00 pm
It seems more and more people have been having problems downloading attachments... in most cases they download as a .php instead.

Any idea what may be causing this?

I know that a few days back I tried a download in FireFox, but it kept trying to give me a .php. I went to IE7 and it worked just fine.

Seems one solution is to try renaming the downloaded .php file to whatever type it should be, i.e. renaming it to a .rar.
Title: Re: Attachment issues
Post by: Iss Mneur on November 26, 2011, 03:36:12 pm
It appears it is a bug in SMF (http://dev.simplemachines.org/mantis/view.php?id=4825).  It seems SMF sends a modified Content-Disposition header to Firefox browsers that is incorrect (https://bugzilla.mozilla.org/show_bug.cgi?id=685060) (ie., not supported by the RFCs).  Older versions of Firefox (https://bugzilla.mozilla.org/show_bug.cgi?id=651185) are not affected because they allowed the incorrect syntax, but starting with FF8 the bug has been fixed which means FF8 users get a bad header that FF will ignore resulting in FF using the name of the file in the url (index.php) rather than the files name as sent by the server.

It appears the correct fix for this issue is to update SMF so that it doesn't sniff the user agent when setting this header, though it doesn't appear that SMF has actually made this fix available in the most recent version.  However, it seems there is a patch available (http://www.simplemachines.org/community/index.php?topic=454734.msg3204632#msg3204632) to fix this problem before the SMF releases a new version.

In the mean time, I have install an addon (https://addons.mozilla.org/en-US/firefox/addon/user-agent-rg/) that changed my user agent to Chrome 11 so SMF doesn't send me the unsupported header.
Title: Re: Attachment issues
Post by: Zacam on November 27, 2011, 12:55:40 am
I just ported the fix as outlined, so let's see what happens.

You may need to do a force-refresh load of HLP first.


***Edit: Disregard previous edit, it should be all good now, despite a slight hiccup.
Title: Re: Attachment issues
Post by: Iss Mneur on November 27, 2011, 01:33:06 am
It doesn't appear to have changed anything for me.  Checking in wireshark it looks like I am still getting different content-disposition headers based on my user agent.  I will try it in the morning to see if its not Cloudflare caching the response (because the cache control headers are set to vary on user-agent (even though a file download is supposed to be a private cache only).

Attaching test attachment.

EDIT: still broken using FF8's default user agent.

[attachment deleted by a basterd]
Title: Re: Attachment issues
Post by: JGZinv on November 27, 2011, 03:52:20 am
FF8 here and that attachment looks like a php file to me.
Yep sorry, it no worky.
Title: Re: Attachment issues
Post by: Zacam on November 27, 2011, 04:06:08 pm
Well, I don't know what to say about that then, other than that the purported fix probably really isn't, but I'll keep an eye on the SMF boards for it.

But at least the "change" (when done properly) doesn't seem to have broken anything. (I'm on Pre-8 on my main machine, so things still look fine)
Title: Re: Attachment issues
Post by: JGZinv on November 27, 2011, 04:35:17 pm
Well I mean it looks to be a 7z file when you look at the post listing, but when you go to download it it comes up as a index.php.
Not sure if that helps any or not...
Title: Re: Attachment issues
Post by: rscaper1070 on November 27, 2011, 05:06:28 pm
I just downloaded the shaders you just posted and it worked as it should.
Title: Re: Attachment issues
Post by: Zacam on November 27, 2011, 06:40:00 pm
rscaper1070: That's because those are a post inline link, not a post attachment.

Like I said, I'll keep up on the issue and I have FF8 on another machine, I'll try to work out some sort of a fix on a split copy of the forums and then migrate the actual working fix soon.
Title: Re: Attachment issues
Post by: Iss Mneur on November 27, 2011, 07:47:31 pm
Okay.  Looking at the SMF bug number 4825 (http://dev.simplemachines.org/mantis/view.php?id=4825), it has a new patch attached, apparently it fixes it without introducing more bugs (with respect to spaces in the file names).

They have several threads on this on the SMF forum.  They seem to have just fixed it there, I have asked SleePy (http://www.simplemachines.org/community/index.php?topic=451766.msg3217487#msg3217487) which fix he actually used.
Title: Re: Attachment issues
Post by: Zacam on November 28, 2011, 12:54:44 am
Okay, so, in theory, this should now be fixed.

[attachment deleted by a basterd]
Title: Re: Attachment issues
Post by: JGZinv on November 28, 2011, 03:22:39 am
Text received, test successful.
Title: Re: Attachment issues
Post by: karajorma on November 28, 2011, 05:46:13 am
Worked for me.
Title: Re: Attachment issues
Post by: z64555 on November 28, 2011, 09:09:31 am
Okay, so, in theory, this should now be fixed.

Works for me, too.  :yes:

Thanks, everyone!
Title: Re: Attachment issues
Post by: Fury on November 29, 2011, 01:42:18 am
Was this full forum upgrade or partial upgrade to fix only this specific issue? Version number would indicate full upgrade, which I hope is the case due to security issues older versions had.
Title: Re: Attachment issues
Post by: Zacam on December 03, 2011, 01:15:53 pm
Oh, I just hacked the display for the version number.

...

...

Or maybe I'm just joking and we actually did get around to doing the upgrade AND implementing the attachment fix.

Who knows.