Closed Bug 233798 Opened 22 years ago Closed 22 years ago

RFC 2231/2047 encoded filename parameter in content-disposition header should be decoded

Categories

(Camino Graveyard :: Downloading, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jshin1987, Assigned: mikepinkerton)

References

()

Details

(Keywords: intl)

Attachments

(2 files)

I found that camino/src/download/SaveHeaderSniffer.mm uses a simple string 'index/search' APIs to obtain the value of 'filename' parameter in Content-Disposition header. This wouldn't work well for RFC 2231/RFC 2047 encoded value (used in filename parameter). In bug 162765, I implemented nsIMIMEHeaderParam to use to decode RFC 2047/2231-encoded words in situations like this.
Attached patch patchSplinter Review
This should work, but I can't test it because I don't have a Mac.
You have to include "nsIMIMEHeaderParam.h" in order for the patch to compile. I have two questions about this patch: 1. if the mURL test fails, then fallbackCharset will be uninitialized when it gets passed to GetParameter (mimehdrpar->GetParameter(...)). Is that OK? 2. What the hell does this patch actually do? I have no idea how to test it. :)
Thanks for trying it. 1. It's all right to leave fallbackCharset empty. 2. What it does is: a. retrieve filename parameter in Content-Disposition header b. if it's RFC 2231-encoded, decode it and convert to UTF-16 and return c. if it's RFC 2047-encoded, decode it and convert to UTF-16 and return d. if it's UTF-8, convert it to UTF-16 and return e. if fallbackCharset is not empty, try to interpret it as if it's in that character encoding and convert to UTF-16 and return Over a dozen test cases are at the URL given in the URL field. See also bug 162765. Try to save files of type 'applicaton/x-random'. All but those marked with 'raw 8bit EUC-JP' should bring up the download box with Korean or Japanese filenames like 한글문서1.yyy and 芸術3.yyy [1] http://www.faqs.org/rfcs/rfc2231.html http://www.faqs.org/rfcs/rfc2047.html
Could you post some testcases or url's for us to test this patch?
I can't make the build with your patch do anything different than our current build with those test cases. I like the patch in the sense that its clean and it seems more robust than our current implementation, but I want to wait to do review+ until I understand more about what it does. I'm inexperienced in this area, and need more explanation.
Never mind - I get it now. Your patch does work - it fixes the filename displayed in the save window. r=josha (with the header included as well)
Attachment #141133 - Flags: superreview?(pinkerton)
Attachment #141133 - Flags: review+
landed.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
embedding/browser/cocoa/src/SaveHeaderSniffer.mm has the same problem. It also uses 'AssignWithConversion' to convert UTF-16 to UTF-8. 'AssignWithConversion' works only for characters below U+0100. It should use CopyUTF16toUTF8, instead.
Comment on attachment 141574 [details] [diff] [review] embedding patch (more or less the same) asking for r/sr.
Attachment #141574 - Flags: superreview?(billpinkerton66)
Attachment #141574 - Flags: review?(josha)
*** Bug 233772 has been marked as a duplicate of this bug. ***
Comment on attachment 141574 [details] [diff] [review] embedding patch (more or less the same) somehow, sr request was sent to a wrong person.
Attachment #141574 - Flags: superreview?(billpinkerton66) → superreview?(pinkerton)
landed embedding patch ads well.
Attachment #141574 - Flags: superreview?(pinkerton)
Attachment #141574 - Flags: review?(josha)
Comment on attachment 141133 [details] [diff] [review] patch Clearing leftover sr?
Attachment #141133 - Flags: superreview?(pinkerton)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: