Commit 6aca7652 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.

parent 0801d73b
...@@ -386,12 +386,14 @@ def _default_mime_types(): ...@@ -386,12 +386,14 @@ def _default_mime_types():
'.taz': '.tar.gz', '.taz': '.tar.gz',
'.tz': '.tar.gz', '.tz': '.tar.gz',
'.tbz2': '.tar.bz2', '.tbz2': '.tar.bz2',
'.txz': '.tar.xz',
} }
encodings_map = { encodings_map = {
'.gz': 'gzip', '.gz': 'gzip',
'.Z': 'compress', '.Z': 'compress',
'.bz2': 'bzip2', '.bz2': 'bzip2',
'.xz': 'xz',
} }
# Before adding new types, make sure they are either registered with IANA, # Before adding new types, make sure they are either registered with IANA,
......
...@@ -21,6 +21,8 @@ class MimeTypesTestCase(unittest.TestCase): ...@@ -21,6 +21,8 @@ class MimeTypesTestCase(unittest.TestCase):
eq(self.db.guess_type("foo.tgz"), ("application/x-tar", "gzip")) eq(self.db.guess_type("foo.tgz"), ("application/x-tar", "gzip"))
eq(self.db.guess_type("foo.tar.gz"), ("application/x-tar", "gzip")) eq(self.db.guess_type("foo.tar.gz"), ("application/x-tar", "gzip"))
eq(self.db.guess_type("foo.tar.Z"), ("application/x-tar", "compress")) eq(self.db.guess_type("foo.tar.Z"), ("application/x-tar", "compress"))
eq(self.db.guess_type("foo.tar.bz2"), ("application/x-tar", "bzip2"))
eq(self.db.guess_type("foo.tar.xz"), ("application/x-tar", "xz"))
def test_data_urls(self): def test_data_urls(self):
eq = self.assertEqual eq = self.assertEqual
......
...@@ -34,6 +34,8 @@ Core and Builtins ...@@ -34,6 +34,8 @@ Core and Builtins
Library Library
------- -------
- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
- Issue #17192: Restore the patch for Issue #10309 which was ommitted - Issue #17192: Restore the patch for Issue #10309 which was ommitted
in 2.7.4 when updating the bundled version of libffi used by ctypes. in 2.7.4 when updating the bundled version of libffi used by ctypes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment