When detaching, comma in target file name or path will break link to local file because X-Mozilla-External-Attachment-URL is truncated at first comma

NEW
Unassigned

Status

MailNews Core
Attachments
12 years ago
2 years ago

People

(Reporter: Jörg Thönnes, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6

If the attachment file name contains a comma ",", the file can be detached
successfully, the reference to the local file system is incomplete. The URL
in the mail contains the complete path up to, but not including the first comma.


Reproducible: Always

Steps to Reproduce:
1. Create a mail with an attachment, eg. "Attach, attach.doc"
2. Save mail as draft, possibly move it to some temp. TEST folder
3. Open saved mail and attachment -- OK
4. Detach attachment
5. Open saved mail with detached file
6. Open the attachment

Actual Results:  
File Not Found

The file .../Attach cannot be found. Please check the location and try again.

Expected Results:  
The detached file ".../Attach, attach.doc" can be located on the filesystem and opened successfully.
Summary: detach of file names with commas stores imcomplete file name → detach of file names with commas stores incomplete file name

Comment 1

12 years ago
I'll look into this...
Assignee: mscott → bienvenu
Status: UNCONFIRMED → NEW
Ever confirmed: true
This applies to WinXP, not just Linux, and is still the case now.
Fixing it might just be a matter of encoding the ',' character before the uri is passed in as a parameter in startProcessing in nsMessenger (http://mxr.mozilla.org/mailnews/source/mailnews/base/src/nsMessenger.cpp#2979).  
In my add-on I've rewritten the detaching part of messenger in JavaScript and simply doing 'replace(/,/g,"%2C")' to the uri string before its used seems to fix it.  I'm not sure what this would be in C++ or where the best place to put it would be though or I'd make the patch file.
Duplicate of this bug: 387639
Duplicate of this bug: 473711
Assignee: bienvenu → nobody
Component: Mail Window Front End → Attachments
Product: Thunderbird → MailNews Core
QA Contact: front-end → attachments

Comment 6

9 years ago
--- Comment #1 from WADA <m-wada@japan.com>  2009-01-14 23:56:38 PST ---
(in response to my duplicate (oops) bug report 387639)
(Q1) Following header was generated after detach, wasn't it?
> > Content-Disposition: ...; filename="Dear, Keith - 13.04.09.doc"
> > X-Mozilla-External-Attachment-URL: file:///C:/.../Dear
> > ("," and string after "," is cut-off)
(Q2) Before detach, the attachment was opened successufully, wasn't it?

Q1: No, nothing was added to the headers after detach, even in View|Headers|All.
Q2: yes that is correct.
(In reply to comment #6)
> even in View|Headers|All.
Check mail source(View/Message Source) and check mail headers for the attachment part.

Comment 8

9 years ago
ok then, yes, after detaching the file the source includes this:

Content-Type: application/msword;
 name="Dear, Keith - 13.04.09.doc"
Content-Disposition: attachment; filename="Dear, Keith - 13.04.09.doc"
X-Mozilla-External-Attachment-URL: file:///C:/temp/Dear
X-Mozilla-Altered: AttachmentDetached; date="Fri Jan 16 08:26:30 2009"

The original MIME headers for this attachment are:
Content-Type: application/msword;
 name="Dear, Keith - 13.04.09.doc"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="Dear, Keith - 13.04.09.doc"

Comment 9

6 years ago
this bug still occurs, using seamonkey 2.13 on linux x86_64.
Also, I believe bug 580253 is a dupe of this bug.
Summary: detach of file names with commas stores incomplete file name → When detaching, link to file broken because X-Mozilla-External-Attachment-URL is truncated at first comma in target file name or path
Duplicate of this bug: 580253
Summary: When detaching, link to file broken because X-Mozilla-External-Attachment-URL is truncated at first comma in target file name or path → When detaching, comma in target file name or path will break link to local file because X-Mozilla-External-Attachment-URL is truncated at first comma
Jim, if comment 2 and comment 3 cited below are true, this looks like a one-line fix?

(In reply to Andrew Williamson [:eviljeff] from comment #2)
> Fixing it might just be a matter of encoding the ',' character before the
> uri is passed in as a parameter in startProcessing in nsMessenger
> (http://mxr.mozilla.org/mailnews/source/mailnews/base/src/nsMessenger.
> cpp#2979).

(In reply to Andrew Williamson [:eviljeff] from comment #3)
> In my add-on I've rewritten the detaching part of messenger in JavaScript
> and simply doing 'replace(/,/g,"%2C")' to the uri string before its used
> seems to fix it.
OS: Linux → All
Hardware: x86 → All

Comment 12

2 years ago
This bug is still open and it's really annoying! Why is it so difficult to fix it? Can someone fix this, please? 
The behaviour looks a little similiar to bug 900117.

BTW: I wonder what people without the possibility to edit the message source do in such cases. I use Header Tools Lite -> Edit Full Source to correct the broken path.
https://addons.mozilla.org/en-US/thunderbird/addon/header-tools-lite/
You need to log in before you can comment on or make changes to this bug.