mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
add failing test for erroneous apostrophed-encoding
This commit is contained in:
@@ -1604,6 +1604,17 @@ mod tests {
|
|||||||
assert_eq!(filename, Some("Auftragsbestätigung.pdf".to_string()))
|
assert_eq!(filename, Some("Auftragsbestätigung.pdf".to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[async_std::test]
|
||||||
|
async fn test_get_attachment_filename_apostrophed_invalid() {
|
||||||
|
let t = TestContext::new().await;
|
||||||
|
let mail = load_mail_with_attachment(
|
||||||
|
&t,
|
||||||
|
include_bytes!("../test-data/message/attach_filename_apostrophed_invalid.eml"),
|
||||||
|
);
|
||||||
|
let filename = get_attachment_filename(&t.ctx, &mail.subparts[1]).unwrap();
|
||||||
|
assert_eq!(filename, Some("somedäüta.html.zip".to_string()))
|
||||||
|
}
|
||||||
|
|
||||||
#[async_std::test]
|
#[async_std::test]
|
||||||
async fn test_get_attachment_filename_combined() {
|
async fn test_get_attachment_filename_combined() {
|
||||||
// test that if `filename` and `filename*0` are given, the filename is not doubled
|
// test that if `filename` and `filename*0` are given, the filename is not doubled
|
||||||
|
|||||||
30
test-data/message/attach_filename_apostrophed_invalid.eml
Normal file
30
test-data/message/attach_filename_apostrophed_invalid.eml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
Subject: Test apostrophed filenames
|
||||||
|
Message-ID: 12345@testrun.org
|
||||||
|
Date: Sat, 07 Dec 2019 19:00:27 +0000
|
||||||
|
To: recp@testrun.org
|
||||||
|
From: sender@testrun.org
|
||||||
|
Content-Type: multipart/mixed; boundary="==BREAK=="
|
||||||
|
|
||||||
|
|
||||||
|
--==BREAK==
|
||||||
|
Content-Type: text/plain; charset=utf-8
|
||||||
|
|
||||||
|
this mail uses filename* in an invalid way,
|
||||||
|
not specifying chatset or language parts.
|
||||||
|
|
||||||
|
see https://tools.ietf.org/html/rfc2231, section 4.:
|
||||||
|
"Note also that the single quote delimiters MUST be present
|
||||||
|
even when one of the field values is omitted."
|
||||||
|
|
||||||
|
however, for now, Delta Chat is generous in this case,
|
||||||
|
just assuming encoded words
|
||||||
|
|
||||||
|
--==BREAK==
|
||||||
|
Content-Type: text/html
|
||||||
|
Content-Disposition: attachment;
|
||||||
|
filename*="=?utf-8?Q?somed=C3=A4=C3=BCta.html.zip?="
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
|
||||||
|
PGh0bWw+PGJvZHk+dGV4dDwvYm9keT5kYXRh
|
||||||
|
|
||||||
|
--==BREAK==--
|
||||||
Reference in New Issue
Block a user