summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-10-28 13:52:34 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-10-28 13:52:34 (GMT)
commit84833aa7b4215bfbc15d2661fec326b5a49e7371 (patch)
treecadb2a2977d1edab3f151051a2c727177a6352fd
parent27ddb576f163f732a89111e3e66c2d8d5e43e9e8 (diff)
downloadcpython-84833aa7b4215bfbc15d2661fec326b5a49e7371.zip
cpython-84833aa7b4215bfbc15d2661fec326b5a49e7371.tar.gz
cpython-84833aa7b4215bfbc15d2661fec326b5a49e7371.tar.bz2
Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
Patch by Serhiy Storchaka.
-rw-r--r--Lib/mimetypes.py2
-rw-r--r--Lib/test/test_mimetypes.py2
-rw-r--r--Misc/NEWS3
3 files changed, 7 insertions, 0 deletions
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index 3f0bd0e..2872ee4 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -378,12 +378,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 91da289..593fdb0 100644
--- a/Lib/test/test_mimetypes.py
+++ b/Lib/test/test_mimetypes.py
@@ -22,6 +22,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 ad2530b..13e3669 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -62,6 +62,9 @@ Core and Builtins
Library
-------
+- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions.
+ Patch by Serhiy Storchaka.
+
- Issue #12890: cgitb no longer prints spurious <p> tags in text
mode when the logdir option is specified.