mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 02:16:29 +03:00
add test for cyrillic encoded-words filenames
This commit is contained in:
@@ -1498,6 +1498,15 @@ mod tests {
|
||||
assert_eq!(filename, Some(" § 165 Abs".to_string()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_attachment_filename_encoded_words_windows1251() {
|
||||
let mail = load_mail_with_attachment(include_bytes!(
|
||||
"../test-data/message/attach_filename_encoded_words_windows1251.eml"
|
||||
));
|
||||
let filename = get_attachment_filename(&mail.subparts[1]).unwrap();
|
||||
assert_eq!(filename, Some("file Что нового 2020.pdf".to_string()))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_attachment_filename_encoded_words_cont() {
|
||||
// test continued encoded-words and also test apostropes work that way
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
Subject: Test encoded-words
|
||||
Message-ID: 123456@testrun.org
|
||||
Date: Sat, 07 Dec 2019 19:00:27 +0000
|
||||
Chat-Version: 1.0
|
||||
To: recp@testrun.org
|
||||
From: sender@testrun.org
|
||||
Content-Type: multipart/mixed; boundary="==BREAK=="
|
||||
|
||||
|
||||
--==BREAK==
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
testing encoded-words filenames with windows-1251 (cyrillic) encoding.
|
||||
|
||||
as a side-effect, this also tests that encoded words work together with
|
||||
plain text as long as they're separated by spaces, see
|
||||
https://tools.ietf.org/html/rfc2047 5.1:
|
||||
|
||||
"Ordinary ASCII text and 'encoded-word's may appear together in the
|
||||
same header field. However, an 'encoded-word' that appears in a
|
||||
header field defined as '*text' MUST be separated from any adjacent
|
||||
'encoded-word' or 'text' by 'linear-white-space'."
|
||||
|
||||
--==BREAK==
|
||||
Content-Type: text/html
|
||||
Content-Disposition: attachment; filename="file =?Windows-1251?B?1/LuIO3u4u7j7g==?= 2020.pdf";
|
||||
Content-Transfer-Encoding: base64
|
||||
|
||||
PGh0bWw+PGJvZHk+dGV4dDwvYm9keT5kYXRh
|
||||
|
||||
--==BREAK==--
|
||||
Reference in New Issue
Block a user