created some new files that should be included.
(Fixed by Tarek Ziadé; :issue:`8688`.)
+ The ``upload`` command now longer tries to change CR end-of-line characters
+ to CRLF. This fixes a corruption issue with sdists that ended with a byte
+ equivalent to CR.
+ (Contributed by Bo Bayles in :issue:`32304`.)
+
* The :mod:`doctest` module's :const:`IGNORE_EXCEPTION_DETAIL` flag
will now ignore the name of the module containing the exception
being tested. (Patch by Lennart Regebro; :issue:`7490`.)
auth = self.last_open.req.headers['Authorization']
self.assertNotIn('\n', auth)
+ # bpo-32304: archives whose last byte was b'\r' were corrupted due to
+ # normalization intended for Mac OS 9.
+ def test_upload_correct_cr(self):
+ # content that ends with \r should not be modified.
+ tmp = self.mkdtemp()
+ path = os.path.join(tmp, 'xxx')
+ self.write_file(path, content='yy\r')
+ command, pyversion, filename = 'xxx', '2.6', path
+ dist_files = [(command, pyversion, filename)]
+ self.write_file(self.rc, PYPIRC_LONG_PASSWORD)
+
+ # other fields that ended with \r used to be modified, now are
+ # preserved.
+ pkg_dir, dist = self.create_dist(
+ dist_files=dist_files,
+ description='long description\r'
+ )
+ cmd = upload(dist)
+ cmd.ensure_finalized()
+ cmd.run()
+
+ headers = dict(self.last_open.req.headers)
+ self.assertEqual(headers['Content-length'], '2170')
+ self.assertIn(b'long description\r', self.last_open.req.data)
+ self.assertNotIn(b'long description\r\n', self.last_open.req.data)
+
def test_upload_fails(self):
self.next_msg = "Not Found"
self.next_code = 404