Files not saved with correct extension in new Mac betas

Discussion about official Mozilla Firefox builds
danb77
Posts: 32
Joined: May 19th, 2004, 7:58 am

Post by danb77 »

Bluefang's diagnosis has allowed me to find an easy work around for the problem.

Just install UserAgent Switcher and use it to spoof arxiv.org into thinking I am on Windows.

This seems to fix all the PDF problems.

@Bluefang: I don't understand your final comment - are you saying that you think the bug lies nevertheless with Firefox and that the server data arxiv.org is sending, while weird, is not inherently incorrect?
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Post by Bluefang »

No, I'm saying that Firefox is behaving correctly based on the data it is receiving from the server. So it's the site that is foobar'ed, not Firefox.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
danb77
Posts: 32
Joined: May 19th, 2004, 7:58 am

Post by danb77 »

www.aboutbyvote.co.uk appears to suffer a similar problem for Macs *and PCs* running Firefox beta 3.

There are PDFs on the site which are served via a redirect. Unfortunately the site requires you to enter a location which sets up a cookie. To test the site enter the postal code N1 1BL when a postal code is requested.

The link "register to vote" will take you to a page where PDF forms are available to download.

Firefox (for Mac and PC) saves them without the desired PDF extension - i.e. as servelet.cfm

Safari (on Mac) and Microsoft IE (on Windows) both save the files *with* the PDF extension.
User avatar
kliu0x52
Posts: 569
Joined: October 18th, 2006, 2:23 pm
Location: .us
Contact:

Post by kliu0x52 »

The first request is a redirect, but it doesn't redirect to the file itself...

Request 1:

Code: Select all

Requested URL:
http://www.aboutmyvote.co.uk/documents/servefile.cfm?fname=2FB164E7-E7F2-6FB3-9B90152F31BF055D.pdf

Response Headers:
Server: Microsoft-IIS/5.0
Date: Tue, 08 Apr 2008 20:21:14 GMT
http: \\aboutmyvote.co.uk:
X-Powered-By: ASP.NET
Connection: close
Location: /documents/servefile.cfm?fname=2FB164E7-E7F2-6FB3-9B90152F31BF055D.pdf&PCode=N11BL&CFID=14082393&CFTOKEN=24970696
Content-Type: text/html; charset=UTF-8


Request 2:

Code: Select all

Requested URL:
http://www.aboutmyvote.co.uk/documents/servefile.cfm?fname=2FB164E7-E7F2-6FB3-9B90152F31BF055D.pdf&PCode=N11BL&CFID=14082393&CFTOKEN=24970696

Response Headers:
Server: Microsoft-IIS/5.0
Date: Tue, 08 Apr 2008 20:21:14 GMT
http: \\aboutmyvote.co.uk:
X-Powered-By: ASP.NET
Connection: close
Content-Type: application/pdf


In the case of the physics paper redirects, it was redirecting to the file itself, and the file had a ".pdf" file name, which Firefox used in the save dialog. If the data is being served directly by a script, which is what's going on here, it is highly recommended that the script add a Content-Disposition header that specifies that the response body contains an attached file and what that file's name should be. When scripts specify this info, Firefox will use the file name given in Content-Disposition.

This fits neither of those two scenarios. Here, the script is directly serving up the data (after a redirect that adds extra request params; since it's the same script, why it is doing something so superfluous and pointless is beyond me, but hey, what did you expect from people who use IIS and ASP.NET?). The script only provides a MIME type. Firefox doesn't append extensions based on the MIME type (except for images saved via saveImageURL()). IIRC (correct me if I'm wrong), this has always been Firefox's / Mozilla's behavior, even long before FF3.

Ideally, the website should have specified a content-disposition in a situation like this...
My addons: NoRedirect | QuickDrag | URL Flipper | TabSubmit
Developers: Make sure to test your addons for RTL compatibility!
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Post by Bluefang »

Yeah, Firefox isn't the thing that is broken in this case, it's poor and broken web site design.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
danb77
Posts: 32
Joined: May 19th, 2004, 7:58 am

Post by danb77 »

Hmm, unfortunately this poor web design seems to be a very common thing.

Many scientific journals are also sending files to Firefox with the wrong extension.

Firefox for Windows, Safari and Internet Explorer all override this and set the extension based on MIME type.

Surely it's a bug if Mac Firefox does not behave the same as these other browsers, even if, in principle, Firefox for Mac is only doing exactly what the web-server is telling it to do?
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Post by Bluefang »

danb77 wrote:Firefox for Windows, Safari and Internet Explorer all override this and set the extension based on MIME type.

No, they aren't renaming the file, the server is sending them different data. There is a difference. If you go back and look at the information I posted, you'd see that Firefox on Linux/Mac is linked directly to the file (which doesn't contain an extension). The Windows copy instead receives a redirect to a different file which dose have an extension.

This is a problem with the software that is running their site.

danb77 wrote:Surely it's a bug if Mac Firefox does not behave the same as these other browsers, even if, in principle, Firefox for Mac is only doing exactly what the web-server is telling it to do?

I disagree. It shouldn't be Firefox's job to account for poor programming on the server side. That would be like Firefox programming in quirks to fix bugs for the PHPBB forum software.

The proper solution is to contact the server administrator to correct their software.


This would be an excellent time to use the "Report Broken Web Site..." in the help menu. In the description, be sure to link it to this topic.
User avatar
RobertJ
Moderator
Posts: 10880
Joined: October 15th, 2003, 7:40 pm
Location: Chicago IL/Oconomowoc WI

Post by RobertJ »

I haven't read the whole thread but it worked for me using FF3b5, Mac PowerPC OSX 10.4.11. The file opened in my browser window with the PDF Browser Plugin

http://www.schubert-it.com/pluginpdf/ with this URL

http://arxiv.org/pdf/0804.0363

I was able to save to the desktop via the plugin and the file name was 0804.0363.pdf

NOTE - the plugin only works on PowerPC Mac.

.
FF 92.0 - TB 78.13 - Mac OSX 10.13.6
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Post by Bluefang »

Rob, that still illustrates the problem.

see this post:
http://forums.mozillazine.org/viewtopic ... 76#3324876

To summarize, the following URL ( http://arxiv.org/pdf/0801.0002 ) serves different data based on your OS/browser

On Windows:
Location:·http://arxiv.org/PS_cache/arxiv/pdf/0801/0801.0002v1.pdf(CR)(LF)

On Linux/Mac:
An actual file

This results with Windows being redirected to a file named 0801.0002v1.pdf where Linux/Mac is directly linked to a file named 0801.0002 (or 0801.0002.pdf if it was saved by Adobe Reader)

Naturally, they will still open in the browser plugin because they both have the MIME type of application/pdf and Reader will automatically append the PDF extension (but the file name won't match what you'd get on Windows). None of this is behavior caused by Firefox.
User avatar
RobertJ
Moderator
Posts: 10880
Joined: October 15th, 2003, 7:40 pm
Location: Chicago IL/Oconomowoc WI

Post by RobertJ »

Bluefang as I said I didn't read the whole thread. To see this action I used User Agent Switcher and pretended to be a Windows XP platform and the site sent me to a different location where the file had the "pdf" extension.

I design web sites and anytime designers use platform detection it is clear that they don't know what they're doing. [-X

Cheers
FF 92.0 - TB 78.13 - Mac OSX 10.13.6
User avatar
Bluefang
Posts: 7857
Joined: August 10th, 2005, 2:55 pm
Location: Vermont
Contact:

Post by Bluefang »

Heh, sorry. I didn't mean to come off as harsh. I was just trying to summarize it for you benefit.
There have always been ghosts in the machine... random segments of code that have grouped together to form unexpected protocols. Unanticipated, these free radicals engender questions of free will, creativity, and even the nature of what we might call the soul...
User avatar
RobertJ
Moderator
Posts: 10880
Joined: October 15th, 2003, 7:40 pm
Location: Chicago IL/Oconomowoc WI

Post by RobertJ »

Bluefang wrote:Heh, sorry. I didn't mean to come off as harsh. I was just trying to summarize it for you benefit.


You weren't harsh. Thanks for the info.

.
FF 92.0 - TB 78.13 - Mac OSX 10.13.6
japanuspus
Posts: 2
Joined: April 8th, 2008, 4:47 am

Post by japanuspus »

For those wanting a quick fix without resorting to UserAgentSwitcher, I just posted a greasemonkey script called arxivPDF on <a href="http://userscripts.org/scripts/show/26893">userscripts.org</a>.

It's a quick hack that simply appends '.pdf' to the pdf-url. I only enabled it on the /abs/-pages.
Post Reply