mirror of
https://github.com/python/cpython.git
synced 2025-10-03 13:45:29 +00:00
[doc] bpo-43066: zipfile - add note on leading slash in the filename arg (GH-26899) (GH-27606)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 7c5dab4340
)
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
This commit is contained in:
parent
60ec3b818e
commit
1a2c0ecfa2
2 changed files with 7 additions and 1 deletions
|
@ -78,7 +78,6 @@ The module defines the following items:
|
||||||
of the last modification to the file; the fields are described in section
|
of the last modification to the file; the fields are described in section
|
||||||
:ref:`zipinfo-objects`.
|
:ref:`zipinfo-objects`.
|
||||||
|
|
||||||
|
|
||||||
.. function:: is_zipfile(filename)
|
.. function:: is_zipfile(filename)
|
||||||
|
|
||||||
Returns ``True`` if *filename* is a valid ZIP file based on its magic number,
|
Returns ``True`` if *filename* is a valid ZIP file based on its magic number,
|
||||||
|
@ -406,6 +405,11 @@ ZipFile Objects
|
||||||
If ``arcname`` (or ``filename``, if ``arcname`` is not given) contains a null
|
If ``arcname`` (or ``filename``, if ``arcname`` is not given) contains a null
|
||||||
byte, the name of the file in the archive will be truncated at the null byte.
|
byte, the name of the file in the archive will be truncated at the null byte.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
A leading slash in the filename may lead to the archive being impossible to
|
||||||
|
open in some zip programs on Windows systems.
|
||||||
|
|
||||||
.. versionchanged:: 3.6
|
.. versionchanged:: 3.6
|
||||||
Calling :meth:`write` on a ZipFile created with mode ``'r'`` or
|
Calling :meth:`write` on a ZipFile created with mode ``'r'`` or
|
||||||
a closed ZipFile will raise a :exc:`ValueError`. Previously,
|
a closed ZipFile will raise a :exc:`ValueError`. Previously,
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Added a warning to :mod:`zipfile` docs: filename arg with a leading slash may cause archive to
|
||||||
|
be un-openable on Windows systems.
|
Loading…
Add table
Add a link
Reference in a new issue