diff options
author | Joel Hillacre <joel@403forbidden.ca> | 2017-06-26 21:41:35 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2017-06-26 21:41:35 (GMT) |
commit | b350c22ebcbb891412e0b334afc9f0db19534e06 (patch) | |
tree | 1b53241cf239c66a84da3c4d328d87ec7cd0b46a /Lib/test | |
parent | f84ac420c2af98339678744953869cad3c253281 (diff) | |
download | cpython-b350c22ebcbb891412e0b334afc9f0db19534e06.zip cpython-b350c22ebcbb891412e0b334afc9f0db19534e06.tar.gz cpython-b350c22ebcbb891412e0b334afc9f0db19534e06.tar.bz2 |
bpo-30532: Fix whitespace folding in certain cases
Leading whitespace was incorrectly dropped during folding of certain lines in the _header_value_parser's folding algorithm. This makes the whitespace handling code consistent.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_email/test__header_value_parser.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_email/test__header_value_parser.py b/Lib/test/test_email/test__header_value_parser.py index 26ece69..e0ec87d 100644 --- a/Lib/test/test_email/test__header_value_parser.py +++ b/Lib/test/test_email/test__header_value_parser.py @@ -2711,5 +2711,17 @@ class TestFolding(TestEmailBase): self._test(parser.get_unstructured('xxx ' + 'y'*77), 'xxx \n ' + 'y'*77 + '\n') + def test_long_filename_attachment(self): + folded = self.policy.fold('Content-Disposition', 'attachment; filename="TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TES.txt"') + self.assertEqual( + 'Content-Disposition: attachment;\n filename="TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TES.txt"\n', + folded + ) + folded = self.policy.fold('Content-Disposition', 'attachment; filename="TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_T.txt"') + self.assertEqual( + 'Content-Disposition: attachment;\n filename="TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_TEST_T.txt"\n', + folded + ) + if __name__ == '__main__': unittest.main() |