mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
fix(GODT-2966): Allow permissive parsing of MediaType parameters for import.
This commit is contained in:
@ -93,9 +93,9 @@ Feature: IMAP import messages
|
||||
},
|
||||
{
|
||||
"content-type": "application/pdf",
|
||||
"content-type-name": <filename>,
|
||||
"content-type-name": "filename",
|
||||
"content-disposition": "attachment",
|
||||
"content-disposition-filename": <filename>,
|
||||
"content-disposition-filename": "filename",
|
||||
"body-is": "somebytes"
|
||||
}
|
||||
]
|
||||
@ -103,10 +103,11 @@ Feature: IMAP import messages
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| message | filename |
|
||||
| "multipart/mixed_with_attachment_encoded.eml" | "=?US-ASCII?Q?filename?=" |
|
||||
# | "multipart/mixed_with_attachment_encoded_no_quote.eml" | =?US-ASCII?Q?filename?= | @todo GODT-2966
|
||||
# | "multipart/mixed_with_attachment_no_quote.eml" | "filename" | @todo GODT-2966
|
||||
| message |
|
||||
| "multipart/mixed_with_attachment_encoded.eml" |
|
||||
| "multipart/mixed_with_attachment_encoded_no_quote.eml" |
|
||||
| "multipart/mixed_with_attachment_no_quote.eml" |
|
||||
|
||||
|
||||
# The message is imported as UTF-8 and the content type is determined at build time.
|
||||
Scenario: Import message as latin1 without content type
|
||||
|
||||
@ -141,6 +141,28 @@ Feature: SMTP sending with attachment
|
||||
}
|
||||
}
|
||||
"""
|
||||
And IMAP client "1" eventually sees the following message in "Sent" with this structure:
|
||||
"""
|
||||
{
|
||||
"subject": "Test with cyrillic attachment",
|
||||
"body-contains": "Shake that body",
|
||||
"content": {
|
||||
"content-type": "multipart/mixed",
|
||||
"sections":[
|
||||
{
|
||||
"content-type": "text/plain",
|
||||
"body-is": "Shake that body"
|
||||
},
|
||||
{
|
||||
"content-type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
"content-type-name": "АБВГДЃЕЖЗЅИЈКЛЉМНЊОПРСТЌУФХЧЏЗШ.docx",
|
||||
"content-disposition": "attachment",
|
||||
"content-disposition-filename": "АБВГДЃЕЖЗЅИЈКЛЉМНЊОПРСТЌУФХЧЏЗШ.docx"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario Outline: Send message with attachment <UseCase>
|
||||
@ -193,29 +215,5 @@ Feature: SMTP sending with attachment
|
||||
Examples:
|
||||
| UseCase | filename |
|
||||
| encoded quoted | "=?US-ASCII?Q?filename?=" |
|
||||
# | non quoted | filename | @todo GODT-2974
|
||||
|
||||
Scenario: Send message with attachment with name unquoted containing special character
|
||||
When SMTP client "1" sends the following message from "[user:user1]@[domain]" to "[user:user2]@[domain]":
|
||||
"""
|
||||
Subject: Message with attachment name
|
||||
Content-type: multipart/mixed; boundary="boundary"
|
||||
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
|
||||
--boundary
|
||||
Content-Type: text/plain
|
||||
|
||||
Hello
|
||||
|
||||
--boundary
|
||||
Content-Type: application/pdf; name==?US-ASCII?Q?filename?=
|
||||
Content-Disposition: attachment; filename==?US-ASCII?Q?filename?=
|
||||
|
||||
somebytes
|
||||
|
||||
--boundary--
|
||||
"""
|
||||
Then it fails
|
||||
And bridge reports a message with "failed to collect attachments: mime: invalid media parameter"
|
||||
| encoded unquoted | =?US-ASCII?Q?filename?= |
|
||||
| non quoted | filename |
|
||||
|
||||
Reference in New Issue
Block a user