Unable to open .eml from file:// uri
Categories
(Thunderbird :: General, defect, P5)
Tracking
(Not tracked)
People
(Reporter: manikulin, Assigned: u695164)
References
Details
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0
Steps to reproduce:
I can not open a mail message fetched using browser namely as mail message, instead new message is created with the specified file as an attachment.
Consider the following use case: reply to particular comment to a bug from https://debbugs.gnu.org This bug tracker uses mail interface to accept new reports or comments. For convenience of other participants it is better to compose a message with proper In-Reply-To
header.
- Choose any bug and any comment to it from https://debbugs.gnu.org
- A random one: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40959#50
- There is "mbox" link. Try to compose real reply to this message: click on the link and choose thunderbird to open the downloaded file
Actual results:
Thunderbird opens compose window with the file containing mail message as attachment.
The download has proper MIME type:
curl -I 'https://debbugs.gnu.org/cgi/bugreport.cgi?msg=50;bug=40959;mbox=yes'
HTTP/1.1 200 OK
Date: Mon, 14 Feb 2022 10:53:37 GMT
Server: Apache
Content-disposition: attachment; filename="bug_40959_message_50.mbox"
Strict-Transport-Security: max-age=63072000
Last-Modified: Fri, 05 Jun 2020 11:24:05 GMT
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block
Content-Type: message/rfc822
However it becomes an ordinary text file as soon as it is downloaded to disk:
file bug_40959_message_50.mbox
bug_40959_message_50.mbox: UTF-8 Unicode text
I have tried various options to open file. Error messages are given for daily build 99a1
Variants: silent failure, a message in the console:
thunderbird bug_40959_message_50.mbox
thunderbird file://`pwd`/bug_40959_message_50.mbox
thunderbird --file bug_40959_message_50.mbox
NS_ERROR_FAILURE: MessengerContentHandler.jsm:80
openURI resource:///modules/MessengerContentHandler.jsm:80
handle resource:///modules/MessengerContentHandler.jsm:553
With absolute path but without explicit file://
scheme compose window appears with the file attached:
thunderbird `pwd`/bug_40959_message_50.mbox
thunderbird --file `pwd`/bug_40959_message_50.mbox
Main window with folder is raised and activated and an error is reported to the console if --mail
option is used:
thunderbird --mail bug_40959_message_50.mbox
Unrecognized URL: bug_40959_message_50.mbox
thunderbird --mail `pwd`/bug_40959_message_50.mbox
Unrecognized URL: /home/ubuntu/bug_40959_message_50.mbox
thunderbird --mail file://`pwd`/bug_40959_message_50.mbox
Unrecognized URL: file:///home/ubuntu/bug_40959_message_50.mbox
Expected results:
- There should be a command line option that forces opening a file as mail message bypassing heuristics.
- Some error message should be shown to user if thunderbird can not handle specified option and argument.
file://
scheme should not cause an error, the URI should be considered as a local file.
Workaround: rename file to give it .eml
extension instead of .mbox
and open it as a relative or absolute path. Warning: do not add explicit file://
scheme otherwise it fails with the following message:
thunderbird file://`pwd`/bug_40959_message_50.eml
NS_ERROR_FILE_TARGET_DOES_NOT_EXIST: Component returned failure code: 0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) [nsICommandLine.resolveFile]
Comment 1•3 years ago
|
||
mbox is not the same as .eml (mbox could be many messages, we should not open those this way).
But I agree if the file:// url ends with .eml we could resolve that as a file and open as well.
I think Services.io.newURI(uri).QueryInterface(Ci.nsIFileURL).file
should do it
(In reply to Magnus Melin [:mkmelin] from comment #1)
mbox is not the same as .eml (mbox could be many messages, we should not open those this way).
I am asking for an option that explicitly tells thunderbird that some file is namely a mail message. I do not mind to get error it there are actually several messages in such file.
There should be a way to override decision based on file suffix. Why it should not be possible to to compose a message with an .eml
file as its attachment?
You implicitly states that FSF version of debbugs has a bug since it sends file name with .mbox
extension, but it must be .eml
.
Instead of just click on a link, thunderbird users have to download, rename the file to allow proper handling of the file. On Linux actual MIME type is often more important than file extension. Unfortunately this is a case when both .mbox
and .eml
are just text, so libmagic can not discriminate them.
Another case. git format-patch
generates files with .patch
suffix. It would be nice to just send them without text rewrapping using SMTP settings in thunderbird when SMTP is not configured for git. However sometimes it is preferable to send the same .patch
file as an attachment. Both options should be supported.
P.S. It is a loosely related feature request, but when thunderbird opens a file with a collection of mail messages it would be nice to get mail folder representation with threads (a viewer for .mbox files).
Comment 3•3 years ago
|
||
You implicitly states that FSF version of debbugs has a bug since it sends file name with .mbox extension, but it must be .eml.
Yes that is a bug. Or maybe they sometimes include more than one message. I have no experience with it.
(In reply to Magnus Melin [:mkmelin] from comment #3)
You implicitly states that FSF version of debbugs has a bug since it sends file name with .mbox extension, but it must be .eml.
Yes that is a bug. Or maybe they sometimes include more than one message. I have no experience with it.
The link and the log I provided are for particular comment that is a single message. At the top of the page there are links for all messages related to that bug:
curl -I 'https://debbugs.gnu.org/cgi/bugreport.cgi?mbox=yes;bug=40959'
HTTP/1.1 200 OK
Date: Tue, 15 Feb 2022 14:52:03 GMT
Server: Apache
Content-disposition: attachment; filename="bug_40959.mbox"
Strict-Transport-Security: max-age=63072000
Last-Modified: Fri, 05 Jun 2020 11:24:05 GMT
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block
Content-Type: text/plain; charset=ISO-8859-1
The extension is the same: .mbox
, but Content-Type
is different. Debian version of debbugs sends application/mbox
for whole bug discussion and .mbox
extension for both single message and for all comments.
So there are both types and browser may launch different handlers for single message and for mailbox with several messages.
Concerning file://
scheme, it may be used to specify particular message in "Local Folders". Handling of file://
scheme with "guess what I mean" approach might cause security issues. E.g. files might be remote file://host/path
.
Could you, please, clarify what is the purpose of the -file
command line option? I can not found a definitive reference. Output of --help
is rather brief and -file
option there has no argument at all unlike e.g. -mail
. Support page https://support.mozilla.org/bm/questions/1264202 points to kb.mozillazine.org.
To attach a file to a new message, it seems there is an explicit way: -compose attachment=FILE
.
"File" -> "Open" -> "Open saved message" allows to relax suffix filter and to open .mbox
or .patch
file. Even multi-message mbox file can be opened is such way, and it is acceptable that everything after first message is considered as its body. Why a similar option is not available from command line (to allow integration with other applications)?
Updated•3 years ago
|
Comment 6•3 years ago
|
||
perhaps -file
is obsolete, because it is not isted at https://udn.realityripple.com/docs/Mozilla/Command_Line_Options
Comment 7•3 years ago
|
||
Looks obsolete yes. The -options arg seems like it should go as well. We don't have an options dialog since ages. What it does atm is weird...
(In reply to Magnus Melin [:mkmelin] from comment #7)
Looks obsolete yes. The -options arg seems like it should go as well. We don't have an options dialog since ages. What it does atm is weird...
I have never mentioned -options
flag, but I would expect that it opens "Preferences" (item from the hamburger menu) as a tab or as a dedicated window.
To be clear, I can force composing a message with an .eml
file as an attachment through
thunderbird -compose attachment=bug_40959_message_50.eml
I am asking for a way to open from command line bug_40959_message_50.mbox
to view it as a mail message. It is possible from menu but requires enough extra click especially if the file is just downloaded by a browser to a temporary directory. Existing -file
option could do it.
Earlier I created Bug #1754415 to make parsing command line more predictable. See e.g. Bug #384384 for an old vulnerability due to ambiguous treatment of arguments.
Concerning original request to ignore file suffix when user explicitly requested to open it as a mail message. Let me remind a relatively recent issue that I accidentally noticed. Heuristics were originally considered powerful enough to drop explicit charset selector, but such change caused problems for some users, see follow-ups of the Bug 1687635.
![]() |
Reporter | |
Comment 10•3 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #7)
Looks obsolete yes. The -options arg seems like it should go as well. We don't have an options dialog since ages. What it does atm is weird...
Firefox has the --preferences
option and it opens a settings tab.
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 11•3 years ago
|
||
FYI: I'm currently prioritized on something else, but we are taking care to get this done.
Comment 12•10 months ago
|
||
Resolved in bug 1816343
![]() |
Reporter | |
Comment 13•10 months ago
|
||
Sorry, but bug 1816343 is another loosely related issue, not the one I reported.
I just have tried thunderbird 1:115.4.1-1~deb12u1 from Debian 12 bookworm.
Effect of
thunderbird 'file:///tmp/bug_40959_message_50.mbox'
is a compose window with bug_40959_message_50.mbox
file treated as an attachment. As I wrote in the comment #5, it was possible earlier using -compose attachment=FILE
.
I requested a way to open mail messages from CLI as it can be done using File → Open → Open Saved message… menu option. I still see no way to explicitly express that I want to open namely a mail message bypassing any heuristics.
Description
•