]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 4 May 2013 12:11:46 +0000 (15:11 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sat, 4 May 2013 12:11:46 +0000 (15:11 +0300)
Lib/mimetypes.py
Lib/test/test_mimetypes.py
Misc/NEWS

index ba4ea8257b660b0f8f1043aed2bc3a06bdfb40c5..18ade7381adabdc149ab6c748722ae529ff2822e 100644 (file)
@@ -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,
index 3508b5605684a46092e6b6cb6beab060b58f7adb..788d7a8360a5c9ae2ccc8dbd5789e9c114037b3f 100644 (file)
@@ -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
index 625d300e84279c20d0777f01c355dc70508f3842..f4387940c61f846e946b1e9b6c2a9f8ead611899 100644 (file)
--- 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.