Open Bug 1143377 Opened 9 years ago Updated 2 years ago

Attach file with space at the end of the name

Categories

(Thunderbird :: Message Reader UI, defect)

31 Branch
x86_64
Windows 8.1
defect

Tracking

(Not tracked)

People

(Reporter: nicolas.croiset, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20150305021524

Steps to reproduce:

You receive an email with a space at the end of the name on a OS windows machine.


Actual results:

when you detach the file, this one is created on the right folder but it is impossible to delete it or doing anything else with that file.



Expected results:

The file should be rename without the space at the end of the name.

example : "toto.jpg " should be rename "toto.jpg"
Tried to delete at Windows Explorer?
When file name in file system is "toto.jpg ", UI of Windows Explorer perhaps thinks file name = "toto.jpg"(no space).
At NTFS file system level, Windows doesn't have limitation in used Unicode characters in file name, and "space" is also a valid file name character.
At Command Prompt, try RENAME "toto.jpg " "ToTo.JPEG". If renamed to ToTo.JPEG you can perjaps access the file via Windows Explorer.

> Expected results:
> The file should be rename without the space at the end of the name.

That's valid file name in File System. If you feel inconvenience, ask to mail sender it, please.
No it is not working, It is impossible to delete the file by the explorer.
I try to rename it, not working.

The only way was by DOS commands as supervisor

procedure :

dir /X in the folder where I have the file.
del short name of the file (8 characters)
(In reply to Nicolas Croiset from comment #2)
> del short name of the file (8 characters)

If Command Prompt, trailing space looks ignored even when quoted by double-quotes. Create/Rename/Delete via API(Script) looks neeeded, unless short name is used.
It is impossible to delete the long name even with double quotes. It is also impossible to delete directly the folder with this kind of file inside it.
(In reply to Nicolas Croiset from comment #4)
> It is also impossible to delete directly the folder with this kind of file inside it.

You are correct, because possible operation from UI is "delete all files in directory, then remove the empty directory".
If from UI, "rename/delete using short name" is needed, because MS Win removes trailing space in file name even when quoted.
If created vi a API, "abc.def " is not 8.3 format name(short name), so short name is assigned and it can be used.

In any case, trailing space of file name should be reoved when Thunderbird/Firefox creates file or file name in any environment.
   save attachment as file, save mail as .eml, send file as attachment, send mail as attachment, ...
Do you see same problem by "Save As" of the attachment of name="toto.jpg "?
   If save as, directory picker dialog is used, and file name is shown in input field.
   This is MS Win's panel, so, even if Tb puts space at end, MS Win may remove it, so problem may not occur. 
How about "save as local file in a directory" by Drag&Drop of the attachment?
When I do save as, the file contain the space at the end of the name also and this one is also saved with the sapce, so it is the same problem after.
It looks next:
  Tb puts "toto.jpg "(no quote, with space) in filename field, and string in the filename field is passed as-is  to Tb, because nothing is touched.
If you type "xxxyyy.ZZZ "(no quote) in filename field when SaveAs, is trailing space removed?
Status: UNCONFIRMED → NEW
Ever confirmed: true
sorry, when I make save as, the name contain the space Then I saved it and check with the explorer and it does not contain the space.
This appears to be more a bug report against Windows Explorer than Thunderbird, which I can reproduce in a way that creating a file with a space at the end isn't correctly handled by Windows 7 tools (even renaming in the document's Properties dialog won't work and gives me an "is the same document" error).

So, the question is if Thunderbird is supposed to be literal with the "filename" attribute for received attachments (in which case it's a garbage-in/garbage-out issue) or if translations of the filename should be made by at least stripping leading or trailing white spaces to avoid OS issues (which on the other hand opens the question if any other characters such as non-printing control characters should be equally removed from the filename before serving it to the Save-As dialog).
Under Windows 8.1, when you do save as : no problem the spaces at the end are automatically removed.
It is only the detach file function which generate that problem which is internal to Thunderbird.
FYI.
Bug 379101 is for issue due to "ending dot in folder name" and "trailing space in folder name".
Because MS Windows ignores  "ending dot in file name" and removes "trailing space in file name", this kind of mismatch happens.
When file for Mbox, no file extension is used by Tb, so "ending dot" and "trailing space" happens.
If file name generated by Tb for data saving, "adding file extension based on mime-type" is possible.
If file extension based on mime-type" is appended, this kind of issue is avoided.
   "toto.jpg " for image/jpeg part => file extension != ".jpg" nor ".jpeg" => add ".jpg" =>  "toto.jpg .jpg"  
   "totojpg." for image/jpeg part => file extension != ".jpg" nor ".jpeg" => add ".jpg" =>  "totojpg.jpg" or  "totojpg..jpg"
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.