Skip to content

[doc] bpo-43066: Zipfile - add note on leading slash in the filename arg #26899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Doc/library/zipfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ The module defines the following items:
of the last modification to the file; the fields are described in section
:ref:`zipinfo-objects`.


.. function:: is_zipfile(filename)

Returns ``True`` if *filename* is a valid ZIP file based on its magic number,
Expand Down Expand Up @@ -406,6 +405,11 @@ ZipFile Objects
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.

.. 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
Calling :meth:`write` on a ZipFile created with mode ``'r'`` or
a closed ZipFile will raise a :exc:`ValueError`. Previously,
Expand Down
Original file line number Diff line number Diff line change
@@ -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.