Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roundcube break attachment name with special characters #9725

Open
Raito00 opened this issue Dec 9, 2024 · 8 comments
Open

Roundcube break attachment name with special characters #9725

Raito00 opened this issue Dec 9, 2024 · 8 comments

Comments

@Raito00
Copy link

Raito00 commented Dec 9, 2024

Hello!
If I receive an attachment with a long name and special characters, the filename appears as Base64 encoding. ...
image

------=_Part_14492_1682898179.1733758206187
Content-Type: application/edoc; 
	name*0="=?UTF-8?B?ZG9rdW1lbnRzLXBhcmFrc3TEq3RzLWFyLWRyb8WhdS1lcGFyYW"; 
	name*1="tzdA==?=
 =?UTF-8?B?YS1kcm/FoXUtcGFyYWtzdHVfdmlzc19zbGlrdGlfd"; 
	name*2="MSBbMWray5lZG9j?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment; 
	filename*=UTF-8''dokuments-parakst%C4%ABts-ar-dro%C5%A1u-eparaksta-dro%C5%A1u-parakstu_viss_slikti_t%C4%81l%C5%ABk.edoc

looks like parts: name0=,name1=,name*2= NOT merge right together...

What browser(s) are you seeing the problem on?

Chrome

What version of Roundcube are you using?

1.6.9

@Raito00
Copy link
Author

Raito00 commented Dec 9, 2024

This will be better sample:
in e-mail attachement 3 files:

Normal_name-āēķčūĒŠķņ.txt
Normal-File_name-āēķčūĒŠķņ_Longer_filename.txt
Normal-File_name-āēķčūĒŠķņ_Longer_filename_double-long.txt

MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_35321_220474746.1733788154376"
X-ESPOL: FJDpT3AYh39OpsK2NYVu5v+StaW+Kjw/zln3k+xwsHNFxcDMz7hpEhyYGZiWeQ+wd33Z8N/fZhlL5Mry
X-KLMS-AntiSpam-Info: LuaCore: 44 0.3.44 5149b91aab9eaefa5f6630aab0c7a7210c633ab6, {Tracking_tags_c_exception}, {Tracking_from_domain_doesnt_match_to}, FromAlignment: s

------=_Part_35321_220474746.1733788154376
Content-Type: multipart/alternative; 
	boundary="----=_Part_35320_360860578.1733788154376"

------=_Part_35320_360860578.1733788154376
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Testi=C5=86=C5=A1 failiem =C4=ABs=C4=81kiem un gar=C4=81kiem.
------=_Part_35320_360860578.1733788154376
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
 <head></head>
 <body>
  Testi=C5=86=C5=A1 failiem =C4=ABs=C4=81kiem un gar=C4=81kiem.
 </body>
</html>
------=_Part_35320_360860578.1733788154376--

------=_Part_35321_220474746.1733788154376
Content-Type: text/plain; 
	name="=?UTF-8?B?Tm9ybWFsX25hbWUtxIHEk8S3xI3Fq8SSxaDEt8WGLnR4dA==?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment; 
	filename*=UTF-8''Normal_name-%C4%81%C4%93%C4%B7%C4%8D%C5%AB%C4%92%C5%A0%C4%B7%C5%86.txt

ZmlsZSBuYW1lIGhhdmUgYSBzcGVjaWFsIGNoYXIgYnV0IHNob3dpbmcgT0s=

------=_Part_35321_220474746.1733788154376
Content-Type: text/plain; 
	name*0="=?UTF-8?B?Tm9ybWFsLUZpbGVfbmFtZS3EgcSTxLfEjcWrxJI=?=
 =?UTF-8"; name*1="?B?xaDEt8WGX0xvbmdlcl9maWxlbmFtZS50eHQ=?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment; 
	filename*=UTF-8''Normal-File_name-%C4%81%C4%93%C4%B7%C4%8D%C5%AB%C4%92%C5%A0%C4%B7%C5%86_Longer_filename.txt

bG9uZ2VyIGZpbGUgbmFtZSBoYXZlIGEgc3BlY2lhbCBjaGFy

------=_Part_35321_220474746.1733788154376
Content-Type: text/plain; 
	name*0="=?UTF-8?B?Tm9ybWFsLUZpbGVfbmFtZS3EgcSTxLfEjcWrxJLFoMS3xYZfTG"; 
	name*1="8=?= =?UTF-8?B?bmdlcl9maWxlbmFtZV9kb3VibGUtbG9uZy50eHQ=?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment; 
	filename*=UTF-8''Normal-File_name-%C4%81%C4%93%C4%B7%C4%8D%C5%AB%C4%92%C5%A0%C4%B7%C5%86_Longer_filename_double-long.txt

Can see short name with special characters showing OK --> but longer file names not ok :(

image

@Raito00
Copy link
Author

Raito00 commented Dec 10, 2024

so how to force roundcube use filename* for attachment names?

@alecpl
Copy link
Member

alecpl commented Dec 10, 2024

I suspect this is an IMAP server fault. Look into BODYSTRUCTURE response in debug log.

@Raito00
Copy link
Author

Raito00 commented Dec 10, 2024

All other mail clients (gmail, sogo, hotmail) have the same mail copy and filenames are OK ...
looks like roundcube try use name0, name1
so how to force use: filename*=

@Raito00
Copy link
Author

Raito00 commented Dec 10, 2024

a fetch 8725 BODYSTRUCTURE
* 8725 FETCH (BODYSTRUCTURE ((("text" "plain" ("charset" "UTF-8") NIL NIL "7bit" 2 0 NIL NIL NIL NIL)("text" "html" ("charset" "UTF-8") NIL NIL "7bit" 56 5 NIL NIL NIL NIL) "alternative" ("boundary" "----=_Part_44487_1151972607.1733816628458") NIL NIL NIL)("text" "plain" ("name" "=?UTF-8?B?Tm9ybWFsX25hbWUtxIHEk8S3xI3Fq8SSxaDEt8WGLnR4dA==?=" "charset" "us-ascii") NIL NIL "base64" 62 1 NIL ("attachment" ("filename*" "UTF-8''Normal_name-%C4%81%C4%93%C4%B7%C4%8D%C5%AB%C4%92%C5%A0%C4%B7%C5%86.txt")) NIL NIL)("text" "plain" ("name" "=?UTF-8?B?Tm9ybWFsLUZpbGVfbmFtZS3EgcSTxLfEjcWrxJI=?= =?UTF-8?B?xaDEt8WGX0xvbmdlcl9maWxlbmFtZS50eHQ=?=" "charset" "us-ascii") NIL NIL "base64" 50 1 NIL ("attachment" ("filename*" "UTF-8''Normal-File_name-%C4%81%C4%93%C4%B7%C4%8D%C5%AB%C4%92%C5%A0%C4%B7%C5%86_Longer_filename.txt")) NIL NIL)("text" "plain" ("name" "=?UTF-8?B?Tm9ybWFsLUZpbGVfbmFtZS3EgcSTxLfEjcWrxJLFoMS3xYZfTG8=?= =?UTF-8?B?bmdlcl9maWxlbmFtZV9kb3VibGUtbG9uZy50eHQ=?=" "charset" "us-ascii") NIL NIL "base64" 50 1 NIL ("attachment" ("filename*" "UTF-8''Normal-File_name-%C4%81%C4%93%C4%B7%C4%8D%C5%AB%C4%92%C5%A0%C4%B7%C5%86_Longer_filename_double-long.txt")) NIL NIL) "mixed" ("boundary" "----=_Part_44488_81865933.1733816628458") NIL NIL NIL))
* 8730 EXISTS

@Raito00
Copy link
Author

Raito00 commented Dec 11, 2024

I think my problem is related to this: Commit 3dbbbd4
#9376
There is some fix for latest version 1.6.9 ? Because many Invoice documents come in with this problem!

@Raito00
Copy link
Author

Raito00 commented Dec 17, 2024

For sure BUG - I`m not alone with this problem!

@alecpl
Copy link
Member

alecpl commented Dec 21, 2024

If I hack the code in rcube_imap::set_part_filename() to use Content-Disposition's filename instead of Content-Type's name parameter, it works.

This is indeed fixed in master, but not in 1.6. Only because we now give priority to the Content-Disposition header.

Looking at RFC2231 and RFC2047 I don't think these Content-Type headers are encoded properly. I have no idea how common this format might be, and whether it exists for messages without Content-Disposition. Maybe we could handle this format better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants