From: Serhiy Storchaka Date: Sat, 4 May 2013 12:11:46 +0000 (+0300) Subject: Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. X-Git-Tag: v2.7.5~27 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6aca765220f5915482c7c4533160b4179aea9faa;p=thirdparty%2FPython%2Fcpython.git Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. --- diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index ba4ea8257b66..18ade7381ada 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -386,12 +386,14 @@ def _default_mime_types(): '.taz': '.tar.gz', '.tz': '.tar.gz', '.tbz2': '.tar.bz2', + '.txz': '.tar.xz', } encodings_map = { '.gz': 'gzip', '.Z': 'compress', '.bz2': 'bzip2', + '.xz': 'xz', } # Before adding new types, make sure they are either registered with IANA, diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py index 3508b5605684..788d7a8360a5 100644 --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -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.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.bz2"), ("application/x-tar", "bzip2")) + eq(self.db.guess_type("foo.tar.xz"), ("application/x-tar", "xz")) def test_data_urls(self): eq = self.assertEqual diff --git a/Misc/NEWS b/Misc/NEWS index 625d300e8427..f4387940c61f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -34,6 +34,8 @@ Core and Builtins Library ------- +- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. + - 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.