Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1004951: Not displaying attachments that contain a slash (/) in their name

57 views
Skip to first unread message

Erik Thiele

unread,
Feb 4, 2022, 3:00:04 AM2/4/22
to
Package: thunderbird
Version: 1:91.5.0-2~deb10u1

Thunderbird is not displaying attachments that contain a slash (/) in
their name. There is also no error message.


Steps to reproduce:

- Open thunderbird to send yourself an email with an attachment, for
example a PDF file. it is called "doc.pdf" in this example here.

- Click on the received email. Click on the attachment and see that it
correctly opens.

- Now right click on the received mail in the mail list and do "save
as". save the email with filename "working.eml"

- quit thunderbird.

- in a shell go in the directory where working.eml is saved and do:
thunderbird working.eml
You will see thunderbird starting, opening the mail. click on the
attachment and see it opens.
quit thundebird again.

- copy working.eml to not_working.eml
open a text editor on not_working.eml

now search for this:

Content-Type: application/pdf; name="doc.pdf"
Content-Disposition: attachment; filename="doc.pdf"
Content-Transfer-Encoding: base64

add slashes at the same position in both filenames like this:

Content-Type: application/pdf; name="do/c.pdf"
Content-Disposition: attachment; filename="do/c.pdf"
Content-Transfer-Encoding: base64

save the file.

- now do
thunderbird not_working.eml
the email opens, you see the attachment named "do/c.pdf"
you can click the attachment, but nothing opens.
no error message, just nothing happens.
but you can right click the attachment and save it.
notice that thunderbird wants to save with "do-c.pdf", so it replaced
the slash (/) by a minus (-).
you can check that the saved file correctly matches the original file.

As you see something is wrong when receiving attachments that contain a
slash (/) in their name.

When you investigate thunderbird with strace like this:

strace -ffff thunderbird working.eml 2>strace_working.txt
then click on the attachment and quit thunderbird

then do

strace -ffff thunderbird not_working.eml 2>strace_not_working.txt
then click on the attachment and quit thunderbird

then do:
grep pdf strace_working.txt |grep open
you will see:
[pid 17250] openat(AT_FDCWD, "/tmp/doc.pdf", O_WRONLY|O_CREAT...

compare this to:
grep pdf strace_not_working.txt |grep open
you will see no try of even saving the attachment.




The way I created the not-working email with a text editor may seem
the source of the problem, but it isn't. I regularly get emails with
slashes in attachment names. I simply did not find a way to create such
an email with commandline tools. All seem to dislike slashes in
attachment names. But since I am regularly receiving this kind of
emails in real life, there must be some (non-unix?) mail program
creating such (bad) attachments.




cu
Erik

Carsten Schoenert

unread,
Feb 5, 2022, 2:10:03 AM2/5/22
to
Hello Erik,

Am 04.02.22 um 08:48 schrieb Erik Thiele:
...
> As you see something is wrong when receiving attachments that contain a
> slash (/) in their name.
>
> When you investigate thunderbird with strace like this:
>
> strace -ffff thunderbird working.eml 2>strace_working.txt
> then click on the attachment and quit thunderbird
>
> then do
>
> strace -ffff thunderbird not_working.eml 2>strace_not_working.txt
> then click on the attachment and quit thunderbird
>
> then do:
> grep pdf strace_working.txt |grep open
> you will see:
> [pid 17250] openat(AT_FDCWD, "/tmp/doc.pdf", O_WRONLY|O_CREAT...
>
> compare this to:
> grep pdf strace_not_working.txt |grep open
> you will see no try of even saving the attachment.
>
>
> The way I created the not-working email with a text editor may seem
> the source of the problem, but it isn't. I regularly get emails with
> slashes in attachment names. I simply did not find a way to create such
> an email with commandline tools. All seem to dislike slashes in
> attachment names. But since I am regularly receiving this kind of
> emails in real life, there must be some (non-unix?) mail program
> creating such (bad) attachments.

in no way a backslash character is a valid character for filenames no
matter which OS you are. And normally any application wouldn't need to
take care about such invalid strings of filenames. So I would not
consider this a "real" issue within Thunderbird.

Even on Windows a backslash isn't a valid character for filenames. Some
guy has collected some information about invalid characters on Windows
systems within this GitHub gist.

https://gist.github.com/doctaphred/d01d05291546186941e1b7ddc02034d3

The next Thunderbird version did some more improvements on work around
such attachments which have invalid filenames. Might be your problem
with broken attachments filenames is then mostly gone away.

https://bugzilla.mozilla.org/show_bug.cgi?id=1747977

If not you should move over to the Mozilla Bugtracker and open a report
there. Within the Debian packaging there is quite nothing we can do
about that, nor should we because this needs to get fixed upstream first.


--
Regards
Carsten
0 new messages