Closed Bug 172693 Opened 22 years ago Closed 22 years ago

[FIXr]Wrong extension appended when cgi script returns unrecognized content type

Categories

(Core Graveyard :: File Handling, defect, P1)

x86
Windows 2000
defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla1.3beta

People

(Reporter: law, Assigned: bzbarsky)

Details

(Keywords: topembed+, Whiteboard: [adt2])

Attachments

(1 file)

4.15 KB, patch
bzbarsky
: review+
hjtoi-bugzilla
: superreview+
Details | Diff | Splinter Review
This bug might replicate an existing one, but I couldn't find one that addressed this specific issue (note that there are a fair number of bugs dealing with some aspect of file etensions). Regardless, I want this one to address this precise issue: If a cgi script returns an unrecognized (by Mozilla) content type, then we will try to find a content handler based on the file extension in the URL. That is almost always guaranteed to result in the wrong thing. A cgi script name has nothing to do with the content type of the data returned by said script. E.g., foobar.asp doesn't return ".asp" data. Usually, the result of this attempt to find a handler based on the URL file extension simply results in us appending the same file extension on the suggested file name when the user ultimately chooses to save to disk. Typically, a cgi such as "foobar.exe?download=something" returns content of type application/foo and specifies a content disposition header like "attachment; filename=something.foo". We don't know what to do with application/foo, so we try to match based on the extension. That leads us to suggest that the user save the file as "foobar.foo.exe" which makes no sense. Patch coming shortly.
Attached patch fixSplinter Review
The patch has three components: 1. Checks for a cgi query URL (presence of "?args") and if found, avoids lookup for a helper app based on the file extension in the URL. 2. In the same situations (a cgi query) leaves the "temp file extension" blank instead of using the file extension from the URL. This will result in the name being suggested to the user not having the cgi extension tacked on. 3. In the case of a CGI script, we get the suggested file name from only the *base* part of the URL. That is, we ignore the extension. So for example, we suggest the name "foobar" (with extension based on the content type, such as "foobar.doc" if the content type is application/msword) instead of "foobar.cgi". Boris has looked at this already and given preliminary approval. I'd like for him to add r=/sr= here (preferably the latter).
Comment on attachment 101778 [details] [diff] [review] fix r/sr=bzbarsky. In the future, we should look at the channel as well and treat it as a "cgi" if it has postdata, but right now we don't have the channel in that code where we need it (I plan to fix that sometime...).
Attachment #101778 - Flags: superreview+
FYI, Patch needed for 1.0.1. Thanks.
1.0.1 was released. we should not worry about the 1.0 branch until we have made a good fix for the trunk and have tested it on the trunk for a while.
QA Contact: sairuh → petersen
Bill, Has it been checked into trunk yet ? Thanks
This is still broken in Build 2002110708 [Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2b) Gecko/20021107]. A workaround for this is to use the hack we use in Horde for IE browsers which have broken Content-Disposition handling (http://cvs.horde.org/diff.php/horde/lib/Browser.php?r1=1.36&r2=1.37&ty=h) - namely put the filename in the PATH_INFO element and the extension as the last argument in the URL. I have no appliction/octet-stream handler set up in my preferences. Thus, http://example.com/download.php -- a script which will send headers for downloading the file test.doc as MIME type 'application/octet-stream' -- is currently saved on windows as test.doc.php. However, if you use the URL http://example.com/download.php/test?f_ext=/test.doc -- the file is correctly saved as test.doc.
If the font-size is equal to the line-height, but the font used has characters that bleed outside its em square, then there will be overlap. The background/ borders/etc go around the font box, which is only indirectly related to the font- size and not at all related to the line-height.
Bill - Is this the issue that affects http://dgl.microsoft.com ? Marking nsbeta1.
Keywords: nsbeta1
Nav triage team: nsbeta1+
Keywords: nsbeta1nsbeta1+
Whiteboard: [adt2]
ian's comment #8 was intended for another bug; not applicable to this one.
Attachment #101778 - Flags: superreview?(heikki)
Attachment #101778 - Flags: superreview+
Attachment #101778 - Flags: review+
Attachment #101778 - Flags: superreview?(heikki) → superreview+
taking to check in
Assignee: law → bzbarsky
Priority: -- → P1
Summary: Wrong extension appended when cgi script returns unrecognized content type → [FIXr]Wrong extension appended when cgi script returns unrecognized content type
Target Milestone: --- → mozilla1.3beta
checked in.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Verified on the 2003-06-09-08 win32 trunk.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: