Malformed filename when attaching files using command line arguments in both Mozilla and Thunderbird



MailNews Core
13 years ago
4 years ago


(Reporter: Carsten Hjorthøj, Unassigned)


1.7 Branch
Windows XP

Firefox Tracking Flags

(Not tracked)




13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier:

I first discovered this bug in Thunderbird, but was told by your bug report
steps to try and reproduce it in Mozilla. This is the bug report I originally
filed on the Thunderbird forum. In all places where I call, in this example,
thunderbird.exe with command line parameters, calling Mozilla.exe with the same
parameters caused the exact same bug:

I am trying to make Thunderbird launch the email composer with a file attached.
The reason I'm doing this is that I use Total Commander and want to be able to
send a file from there by simply using a hotkey. I've had problems with this,
and it appears that the main part of the problem is that I can't get Thunderbird
to handle the command line argument properly. I'm running this on WinXP, by the
way. I've reliably reproduced this problem constantly:

In the command line (cmd.exe) I type this from the Thunderbird directory:
thunderbird -compose "attachment='file:///f:\gamle fsv-ting\demografi eksamen.xls'"

The result is invariably this: The email composer launches nicely, the file is
attached, and I can send it without problems. (most other ways I try in the
command line fail to let me get this far). When sending the mail to myself for
testing, the file is there, and I can open it and all is fine EXCEPT: The
file-name of the attached file is corrupted. If I save the file, it'll be called
"f--gamle fsv-ting-demografi eksamen.xls", and when displayed in the incoming
message, the filename actually looks like the full path name. It looks the same
way in the compose window.

Apparently, this is what's happening, at least as I guess it: Thunderbird reads
the stuff after file:/// as the filename proper, i.e. without path, and this is
the filename it attaches to the file. However, when I press send to attach the
mail, because the filename includes what would normally be considered a path,
Thunderbird actually does find the file, and thus the correct file gets sent but
with a bad filename.

Now, if I'm correct about this, it seems like a bug to me. If I'm not, or even
if I am and you still now one, please let me know how I can get this to work

Now, of course, I've also considered switching the directories around. So I
tried calling this from the command line instead, having switched to the
f:\gamle fsv-ting\ directory:

"c:\programmer\mozilla thunderbird\thunderbird.exe" -compose
"attachment='file:///demografi eksamen.xls'"

In this case, when trying to send, I get an error:

Sending of message failed.
Unable to open the temporary file c:\programmer\mozilla thunderbird\demografi
Check your 'Temporary directory' setting. 

Reproducible: Always

Steps to Reproduce:
1. Start Mozilla (or Thunderbird)
2. At command line, go to the Mozilla directory, then type:
3. mozilla.exe -compose "attachment='file:///f:\gamle fsv-ting\demografi
4. In the above example, of course you must use a file of your own, placed in a
different directory than the installation directory of Mozilla (or Thunderbird,
which is what I'm using). The filename can be anything - I've reproduced this
with not-long file names as well (i.e. 1-8 characters in file name, 3 characters
in extension, all alphabetical).

Actual Results:  
Message composer opens, file is attached, I can send it, and when testing I also
receive the correct file. But the name of the received file is malformed, such
as "f--gamle fsv-ting-demografi eksamen.xls"

Expected Results:  
The filename should have been "demografi eksamen.xls". Mozilla / Thunderbird
should have recognized, that all the "f:\..." stuff was just a path indication
NOT to attach with the name of the file being sent.
What's the escape character in strings for the windows shell?  Is it not '\'?

Comment 2

11 years ago
Perhaps related to bug 384160 ?
MozillaAS v1.7.x is not supported anymore.

Can you reproduce with SeaMonkey v1.1.9 ?
(or Thunderbird v2.0.0.12 ?)
Version: unspecified → 1.7 Branch


9 years ago
Assignee: general → nobody
Component: General → Backend
Product: SeaMonkey → MailNews Core
QA Contact: general → backend
(In reply to comment #1)
> What's the escape character in strings for the windows shell?  Is it not '\'?

The Windows cmd.exe shell uses no escape characters at all, but double quotes around the whole path.
Ah, ok.  In any case, the right directory delimiter in a URI (NOT a filename) is always '/'.  So file:///f:/gamle%20fsv-ting/demografi%20eksamen.xls would be a valid URI that I would expect Thunderbird to get the correct filename from.

The fact that the "right" file gets sent with the backslashes sounds like a bug to me.


4 years ago
See Also: → bug 900117
You need to log in before you can comment on or make changes to this bug.