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

Patch by Serhiy Storchaka.
This commit is contained in:
Nadeem Vawda 2012-10-28 14:52:34 +01:00
parent 27ddb576f1
commit 84833aa7b4
3 changed files with 7 additions and 0 deletions

View File

@ -378,12 +378,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,

View File

@ -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.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

View File

@ -62,6 +62,9 @@ Core and Builtins
Library 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 - Issue #12890: cgitb no longer prints spurious <p> tags in text
mode when the logdir option is specified. mode when the logdir option is specified.