Closed Bug 485514 Opened 16 years ago Closed 16 years ago

drag & drop attachments truncates name part with '&'

Categories

(MailNews Core :: Attachments, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.0b3

People

(Reporter: philbaseless-firefox, Assigned: philbaseless-firefox)

References

Details

Attachments

(2 files)

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/20090312 Shredder/3.0b3pre 1.make arbitrary file with &, e.g. 'New text & file.txt' 2.draft letter and save and view in 3 pane. 3.tool tip and save message saves full name. 4.drag to o/s saves file as 'New text ' related bug 407577. fixes should try to fix both bugs. bug 401542 may be related
Flags: wanted-thunderbird3?
Assignee: nobody → philbaseless-firefox
Attached file email test
open with shredder and drag attachments to local directory. Names are truncated at & and %nn is escaped instead of rendering unescaped.
saving attachments work ok, only dragging. The front end code is msgHdrViewOverlay.js and is getting data from this backend.
Attachment #371611 - Flags: review?(bienvenu)
Status: NEW → ASSIGNED
Flags: wanted-thunderbird3? → wanted-thunderbird3+
Target Milestone: --- → Thunderbird 3.0b3
Phil, I thought you were going to comment about opening/saving/dragging, since it seemed to me that changing the libmime code would affect more than just dragging.
Sorry, meant to answer it in IRC. The double clicking, save as, and opening the attachment also truncates the name part. But this patch fixes that problem also.
double clicking, opening, and save as all seem to do the right thing w/o the patch for me, on vista. I sent a file called "New text & file.txt" as an attachment. Drag and drop did truncate the file. I'll try with the patch.
with this patch, when I do the drag drop, I'm getting 0 byte files - maybe I was just lucky before, but w/o the patch, I was actually getting the right data in the file.
Mine works ok. Rechecking all with file name 'New %26 test.txt' and 'New & test.txt' Right click attachment or menu: file->attachments both 'save as' works Right click or file->attachment menu item 'open' brings up dialog box then both 'save' and open file is incorrect. I'll rebuild and check on the 0 byte thing but it worked before.
Mine works ok. Rechecking all with file name 'New %26 test.txt' and 'New & test.txt' Right click attachment or menu: file->attachments both 'save as' works Right click or file->attachment menu item 'open' brings up dialog box then both 'save' and open file is incorrect. First one saves as "New & test.txt' second one just saves as 'New' dragging file does not result in 0 byte file for me.
http://mxr.mozilla.org/comm-central/source/mailnews/local/src/nsMailboxService.cpp#354 This location appends a second "&filename=" which although is escaped by the js code, it is not used by the 'open with' code (or maybe the dialog box). The first &filename= is used and is unescaped. I don't know why we have 2 &filename=. Can I correct that here? As far as the 'save as', I'll review that and make another comment but it appears if it goes direct to the filepicker we are loading the escaped displayname (second $filename=) as the default 'save as' name which makes it correct.
http://mxr.mozilla.org/comm-central/source/mailnews/base/src/nsMessenger.cpp#851 save as b/e code uses the display name that is escaped and it seems to be further 'sanitized'. Nevertheless the url still has an unencoded filename fixed in this patch.
A file from IMAP account has correct file names in all aspects. But the files received from OExp agent have incorrect data. I'll file a separate bug on that. My tests are simple drafts in the local folders inbox. David, can you confirm those situations? I haven't tried POP yet.
I think it's the nsMailboxUrl doesn't work.
in IMAP the nsImapService sets the filename from the encoded one passed in from the js code at least in handling attachments in msgHdrViewOverlay.js. http://mxr.mozilla.org/comm-central/source/mailnews/imap/src/nsImapService.cpp#404 The nsMailboxService.cpp sets the filename here http://mxr.mozilla.org/comm-central/source/mailnews/base/util/nsMsgMailNewsUrl.cpp#384 The above setting correctly copies up to the '&' because there shouldn't be one in the name. It get the bad name from the 'spec' which is corrected by this patch.
Comment on attachment 371611 [details] [diff] [review] attachment display code fix sorry for the delay - this does seem like the right thing to do. Now that vista drag drop works, I can test this out a bit. I'm going to land a slightly tweaked version of this patch, where we check if (NS_SUCCEEDED) instead of failed, and switch the statements around.
Attachment #371611 - Flags: superreview+
Attachment #371611 - Flags: review?(bienvenu)
Attachment #371611 - Flags: review+
fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: