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
attachment name is broken if it is in utf8 and longer than 24 characters #6048
Comments
|
So, the message was created by Roundcube and you think it is malformed, or the message was created by some other client and Roundcube displays it wrong? Roundcube trusts BODYSTRUCTURE response, so check this in your debug log. I think it's more likely a bug on imap server side. |
|
any MUA (thunderbird, K9, roundcube, default android MUA were tested) sending attachment as I described, causing RC to break attachment name as for the server, it is not changing the message itself, but I'll check that as you suggest |
|
the only difference I see is how RC receives name ... by chunks, while in telnet connection it comes as single piece telnet sessionRC debug |
|
I'm not sure it's related, but my imap server returns also this: but if I comment out "filename" handling, it's still decoded correctly. So, I suppose the headers are encoded correctly. Could you provide a complete sample message? |
|
The sample works for me. So, more investigation needed. I'm using PHP 7.1, but I wouldn't say it's PHP's fault. Could you provide BODYSTRUCTURE response from your IMAP server for the same message? |
here it is |
|
The second response is evidently malformed by the server. So, what's going on here. Roundcube sees that there are filename* "fields" in the header. In such case it's fetching complete header and uses it to get the attachment name. Maybe we could detect that and fallback to the name specified in BODYSTRUCTURE response. |
|
sorry much, I didn't catch in sight that but it was copy-paste error |
|
was it helpful? |
|
Now I have no clue. While obviously your BODYSTRUCTURE response is different than mine, I'm talking about "filename" part, I'm not able to reproduce the issue even if I change the code to use your bodystructure. What is your locale? What default character set (Preferences > Displaying Messages > Advanced Options)? Did you try different browser? Did you try different skin? Did you try with disabled all plugins? Do you have php-mbstring and/or php-iconv installed? Where exactly do you see the broken text, in message preview or when downloading the file? |
|
|
I should have find this earlier. Anyway, there's a bug in handling names encoded this way: RFC2047: "The 'encoded-text' in an 'encoded-word' must be self-contained; 'encoded-text' MUST NOT be continued from one 'encoded-word' to another. This implies that the 'encoded-text' portion of a "B" 'encoded-word' will be a multiple of 4 characters long;". As you see the text in first element has 63 characters. so it's an imap4d bug. However, we could probably implement a workaround. |
|
Fixed. |
attachment name is broken if it is utf8 and longer than 24 characters
resources
attached file name expected
абвгдеёжзиклмнопрстуф хцчшщъыьэюя.docxattached file name provided by RC
Ð°Ð±Ð²Ð³Ð´ÐµÑ Ð¶Ð·Ð¸ÐºÐ»Ð¼Ð½Ð¾Ð¿Ñ Ñ Ñ Ñ Ñ Ñ Ñ ÑF#F'F+F_F3F7F;F_¹ ½ .docxRC config
$config['mime_param_folding'] = 1;original message fragment:
telnet session fragment
RC debug fragment
miscelaneous
uudeview decodes correctly
The text was updated successfully, but these errors were encountered: