Commit Graph

85 Commits

Author SHA1 Message Date
Serhiy Storchaka 80a9fd77a0 Issue #9720: zipfile now writes correct local headers for files larger than 4 GiB. 2013-01-15 00:29:51 +02:00
Ezio Melotti 9e94972eed #14313: zipfile now raises NotImplementedError when the compression type is unknown. 2012-11-18 13:18:06 +02:00
Antoine Pitrou 02512fb1cf Issue #16408: Fix file descriptors not being closed in error conditions in the zipfile module.
Patch by Serhiy Storchaka.
2012-11-17 23:56:53 +01:00
Jesus Cea 93d628b378 Closes #16183: ZipExtFile object close without file handle closed (backporting of Issue #9846) 2012-11-04 02:32:08 +01:00
R David Murray 3f4ccbabaf #14399: zipfile now correctly handles comments added to empty zipfiles.
Patch by Serhiy Storchaka.
2012-04-12 18:42:47 -04:00
Senthil Kumaran ddd40312d5 Fix closes Issue6090 - Raise a ValueError, instead of failing with unrelated
exceptions, when a document with timestamp earlier than 1980 is provided to
zipfile. Patch contributed by  Petri Lehtinen.
2011-10-20 01:38:35 +08:00
R David Murray 873c583244 #10694: zipfile now ignores garbage at the end of a zipfile.
Original fix by 'rep', final patch (with tests) by Xuanji Li.
2011-06-09 16:01:09 -04:00
Georg Brandl 86e0c89b2a Merged revisions 85455 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85455 | georg.brandl | 2010-10-14 08:59:45 +0200 (Do, 14 Okt 2010) | 1 line

  #1710703: write zipfile structures also in the case of closing a new, but empty, archive.
........
2010-11-26 07:22:28 +00:00
Antoine Pitrou e4195e8825 Merged revisions 84737 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84737 | antoine.pitrou | 2010-09-12 16:51:20 +0200 (dim., 12 sept. 2010) | 4 lines

  Issue #9837: The read() method of ZipExtFile objects (as returned by
  ZipFile.open()) could return more bytes than requested.
........
2010-09-12 14:56:27 +00:00
Antoine Pitrou e1436d1092 Merged revisions 83959-83960 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83959 | antoine.pitrou | 2010-08-12 17:11:50 +0200 (jeu., 12 août 2010) | 5 lines

  Issue #7467: when a file from a ZIP archive, its CRC is checked and a
  BadZipfile error is raised if it doesn't match (as used to be the
  case in Python 2.5 and earlier).
........
  r83960 | antoine.pitrou | 2010-08-12 17:15:01 +0200 (jeu., 12 août 2010) | 3 lines

  Typo.
........
2010-08-12 15:25:51 +00:00
Ronald Oussoren dd25e86cf4 Issue 6003: ZipFile.writestr "compression_type" argument 2010-02-07 20:18:02 +00:00
Ezio Melotti 4611b05bd8 avoid to use zlib when the compress type is not ZIP_DEFLATED 2010-01-28 01:41:30 +00:00
Antoine Pitrou 94c33ebfa8 Issue #7610: Reworked implementation of the internal
:class:`zipfile.ZipExtFile` class used to represent files stored inside
an archive.  The new implementation is significantly faster and can
be wrapped in a :class:`io.BufferedReader` object for more speedups.
It also solves an issue where interleaved calls to `read()` and
`readline()` give wrong results.  Patch by Nir Aides.
2010-01-27 20:59:50 +00:00
Ezio Melotti 569e61f351 #5511: Added the ability to use ZipFile as a context manager. Patch by Brian Curtin. 2009-12-30 06:14:51 +00:00
Amaury Forgeot d'Arc 3e5b027a64 #6511: ZipFile will now raise BadZipfile when opening an empty or tiny file,
like it does for larger invalid files.
2009-07-28 22:15:30 +00:00
Gregory P. Smith 2662733bce Fixes the last problem mentioned in issue1202. 2009-06-26 07:50:21 +00:00
Martin v. Löwis 0b09c42ffe Issue #6050: Don't fail extracting a directory from a zipfile if
the directory already exists.
2009-05-24 19:30:52 +00:00
Benjamin Peterson b91e8ede7a make sure files are closed using the with statement 2009-05-10 02:29:00 +00:00
Antoine Pitrou 97377bf566 Issue #5692: In :class:`zipfile.Zipfile`, fix wrong path calculation when extracting a file to the root directory. 2009-05-04 21:17:17 +00:00
Benjamin Peterson bf6c410b2e revert unrelated change 2009-05-02 17:35:39 +00:00
Benjamin Peterson 6282169142 remove py3k compat code 2009-05-02 17:33:01 +00:00
Martin v. Löwis 0dfcfc8b59 Issue #4710: Extract directories properly in the zipfile module;
allow adding directories to a zipfile.
2009-01-24 14:00:33 +00:00
Amaury Forgeot d'Arc 2407ac9a4b follow-up of #3997: since 0xFFFF numbers are not enough to indicate a zip64 format,
always try to read the "zip64 end of directory structure".
2009-01-17 22:43:50 +00:00
Amaury Forgeot d'Arc d25f87ae36 #3997: zipfiles generated with more than 65536 files could not be opened
with other applications.

Reviewed by Martin, will backport to 2.6 and 3.0
2009-01-17 16:40:17 +00:00
Antoine Pitrou 6f193e0e95 Issue #4756: zipfile.is_zipfile() now supports file-like objects.
Patch by Gabriel Genellina.
2008-12-27 15:43:12 +00:00
Antoine Pitrou ebcd0ced14 Issue #3535: zipfile couldn't read some zip files larger than 2GB.
Reviewed by Amaury Forgeot d'Arc.
2008-09-05 23:30:23 +00:00
Antoine Pitrou c53427087e fix ZipFile.testzip() to work with very large embedded files 2008-08-17 13:06:29 +00:00
Antoine Pitrou 5fdfa3e36d #3394: zipfile.writestr doesn't set external attributes, so files are extracted mode 000 on Unix 2008-07-25 19:42:26 +00:00
Amaury Forgeot d'Arc ae6d2b9175 #3317 in zipfile module, restore the previous names of global variables:
some applications relied on them.

Also remove duplicated lines.
2008-07-11 21:28:25 +00:00
Martin v. Löwis 8c43641271 Patch #1622: Correct interpretation of various ZIP header fields.
Also fixes
- Issue #1526: Allow more than 64k files to be added to Zip64 file.

- Issue #1746: Correct handling of zipfile archive comments (previously
  archives with comments over 4k were flagged as invalid). Allow writing
  Zip files with archives by setting the 'comment' attribute of a ZipFile.
2008-07-03 12:51:14 +00:00
Georg Brandl 112aa50329 Patch #1775025: allow opening zipfile members via ZipInfo instances.
Patch by Graham Horler.
2008-05-20 08:25:48 +00:00
Martin v. Löwis 471617d6d3 Issue #1734346: Support Unicode file names for zipfiles. 2008-05-05 17:16:58 +00:00
Gregory P. Smith bf02e3bb21 Fix the struct module DeprecationWarnings that zipfile was triggering by
removing all use of signed struct values.

test_zipfile and test_zipfile64 pass.  no more warnings.
2008-03-19 03:14:41 +00:00
Gregory P. Smith b89a096d6d Use zlib's crc32 routine instead of binascii when available. zlib's is faster
when compiled properly optimized and about the same speed otherwise.
2008-03-19 01:46:10 +00:00
Gregory P. Smith da407232e0 Document that zipfile decryption is insanely slow and fix a typo and
blatant lie in a docstring (it is not useful for security regardless of
how you spell it).
2008-01-20 01:32:00 +00:00
Gregory P. Smith 0c63fc23c4 Fix zipfile decryption. The check for validity only worked on one
type of encrypted zip files.  Files using extended local headers
needed to compare the check byte against different values.  (according
to reading the infozip unzip crypt.c source code)

Fixes issue1003.
2008-01-20 01:21:03 +00:00
Gregory P. Smith 350d03b18a Fixes/Accepts Patch for issue1189216 - Work properly with archives
that have file headers past the 2**31 byte boundary.
2008-01-19 23:10:52 +00:00
Raymond Hettinger 351e1a3e88 Fix 1698398: Zipfile.printdir() crashed because the format string expected a tuple object of length six instead of a time.struct_time object. 2008-01-14 22:58:05 +00:00
Georg Brandl 62416bcf5a #467924, patch by Alan McIntyre: Add ZipFile.extract and ZipFile.extractall. 2008-01-07 18:47:44 +00:00
Georg Brandl 4b3ab6fcc0 Patch #1675424: Added tests for uncovered code in the zipfile module.
The KeyError raised by Zipfile.getinfo for nonexistent names now has
  a descriptive message.
2007-07-12 09:59:22 +00:00
Tim Peters ea5962f86e Whitespace normalization. 2007-03-12 18:07:52 +00:00
Martin v. Löwis 3eb7648986 Patch #1121142: Implement ZipFile.open. 2007-03-06 10:41:24 +00:00
Martin v. Löwis 84f6de9d7e Patch #1517891: Make 'a' create the file if it doesn't exist.
Fixes #1514451.
2007-02-13 10:10:39 +00:00
Martin v. Löwis c6d626ed9f Patch #698833: Support file decryption in zipfile. 2007-02-13 09:49:38 +00:00
Tim Peters f79c32dbfb ZipFile.close(): Kill the other struct.pack deprecation
warning on Windows.

Afraid I can't detect a pattern to when the pack formats decide
to use a signed or unsigned format code -- appears nearly
arbitrary to my eyes.  So I left all the pack formats alone and
changed the special-case data values instead.
2006-07-31 02:53:03 +00:00
Tim Peters 352bf0d7ee ZipFile.close(): Killed one of the struct.pack deprecation
warnings on Win32.

Also added an XXX about the line:

                pos3 = self.fp.tell()

`pos3` is never referenced, and I have no idea what the code
intended to do instead.
2006-07-31 02:40:23 +00:00
Tim Peters a608bb228c Whitespace normalization. 2006-06-15 18:06:29 +00:00
Ronald Oussoren 143cefb846 Patch #1446489 (zipfile: support for ZIP64) 2006-06-15 08:14:18 +00:00
Georg Brandl 8f7c54eaa5 Bug #1413790: zipfile now sanitizes absolute archive names that are
not allowed by the specs.
2006-02-20 08:40:38 +00:00
Martin v. Löwis 0075690ced Patch #1412872: zipfile: use correct system type on unixy systems. 2006-02-05 17:09:41 +00:00