deltachat / deltachat-core-rust

Delta Chat Rust Core library, used by Android/iOS/desktop apps, bindings and bots 📧
https://delta.chat/en/contribute
Other
659 stars 84 forks source link

if pdf attachment names contain spaces, they cannot be opened #1854

Closed gitgerardo closed 3 years ago

gitgerardo commented 4 years ago
Hocuri commented 4 years ago

I could not reproduce this on Android 9, Fairphone 3, DC 1.6.2, not even if I denied storage permission to DC.

Does this still happen if you allow storage permission for DC in the system settings?

r10s commented 4 years ago

may it be that the error comes from the app handling the pdf, not from Delta Chat?

@gitgerardo can you provide a screenshot?

gitgerardo commented 4 years ago

Yes , this still happens if I allow storage permission for DC in the system settings.

gitgerardo commented 4 years ago

may it be that the error comes from the app handling the pdf, not from Delta Chat?

@gitgerardo can you provide a screenshot?

I tried to open the two pdf attachments you see in the screenshot with different PDF viewers.It's not possible to open the second one .I have to save it before I can open it. After saving it has a very long name: "utf-8''Risikoeinscha%CC%88tzungCoronaMusikSpahnRichterUpdate6.5.2020.%20pdf.pdf"

Screenshot_Delta_Chat_20200511-165955 Screenshot_Xodo_Docs_20200511-170132

gerryfrancis commented 4 years ago

Confirmed.

I do not know if this is intended, but the space character is replaced by an underscore. Edit: According to RFC 1342, an underscore should be used instead of a space character, so this OK.

gerryfrancis commented 4 years ago

When we mention the character set (UTF-8), we have something like this:

filename*="=?utf-8?q?Hello=5FGerry_Francis=2Epdf?="

But according to RFC 2231, the value should be formed like this:

filename*=utf-8''Hello_Gerry%20Francis.pdf

I have formed this after reading the documentation, I cannot check out if my interpretation is correct, maybe someone else can do it.

gerryfrancis commented 4 years ago

Indeed, there is a difference! Here is a better example:

File named Hello_Gerry Francis_ÄÖÜäöü.pdf (with German umlauts).

Posteo Webmail (distorted in Delta Chat):

filename*0*=UTF-8''Hello_Gerry%20Francis_%C3%84%C3%96%C3%9C%C3%A4%C3%B6;
 filename*1*=%C3%BC.pdf

grafik

Delta Chat (distorted in Posteo Webmail): filename*="=?utf-8?b?SGVsbG9fR2VycnkgRnJhbmNpc1/DhMOWw5zDpMO2w7wtMzQ2OTY4Nzk3OC5wZGY=?="

gerryfrancis commented 4 years ago

Another thing that probably violates with RFC 2047 is this:

An 'encoded-word' may not be more than 75 characters long, including 'charset', 'encoding', 'encoded-text', and delimiters. If it is desirable to encode more text than will fit in an 'encoded-word' of 75 characters, multiple 'encoded-word's (separated by CRLF SPACE) may be used.

In the Delta Chat encoding, I was counting 76 characters instead of 75.

r10s commented 3 years ago

closed in favor to more concrete https://github.com/deltachat/deltachat-core-rust/issues/2079