Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8f7c54ea
Kaydet (Commit)
8f7c54ea
authored
Şub 20, 2006
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bug #1413790: zipfile now sanitizes absolute archive names that are
not allowed by the specs.
üst
200a5805
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
5 deletions
+26
-5
libzipfile.tex
Doc/lib/libzipfile.tex
+5
-2
test_zipfile.py
Lib/test/test_zipfile.py
+10
-0
zipfile.py
Lib/zipfile.py
+5
-3
NEWS
Misc/NEWS
+6
-0
No files found.
Doc/lib/libzipfile.tex
Dosyayı görüntüle @
8f7c54ea
...
...
@@ -140,10 +140,13 @@ cat myzip.zip >> python.exe
compress
_
type
}}}
Write the file named
\var
{
filename
}
to the archive, giving it the
archive name
\var
{
arcname
}
(by default, this will be the same as
\var
{
filename
}
). If given,
\var
{
compress
_
type
}
overrides the value
\var
{
filename
}
, but without a drive letter and with leading path
separators removed). If given,
\var
{
compress
_
type
}
overrides the value
given for the
\var
{
compression
}
parameter to the constructor for
the new entry. The archive must be open with mode
\code
{
'w'
}
or
\code
{
'a'
}
.
\code
{
'a'
}
.
\note
{
Archive names should be relative to the archive root, that is,
they should not start with a path separator.
}
\end{methoddesc}
\begin{methoddesc}
{
writestr
}{
zinfo
_
or
_
arcname, bytes
}
...
...
Lib/test/test_zipfile.py
Dosyayı görüntüle @
8f7c54ea
...
...
@@ -45,6 +45,16 @@ class TestsWithSourceFile(unittest.TestCase):
for
f
in
(
TESTFN2
,
TemporaryFile
(),
StringIO
()):
self
.
zipTest
(
f
,
zipfile
.
ZIP_DEFLATED
)
def
testAbsoluteArcnames
(
self
):
zipfp
=
zipfile
.
ZipFile
(
TESTFN2
,
"w"
,
zipfile
.
ZIP_STORED
)
zipfp
.
write
(
TESTFN
,
"/absolute"
)
zipfp
.
close
()
zipfp
=
zipfile
.
ZipFile
(
TESTFN2
,
"r"
,
zipfile
.
ZIP_STORED
)
self
.
assertEqual
(
zipfp
.
namelist
(),
[
"absolute"
])
zipfp
.
close
()
def
tearDown
(
self
):
os
.
remove
(
TESTFN
)
os
.
remove
(
TESTFN2
)
...
...
Lib/zipfile.py
Dosyayı görüntüle @
8f7c54ea
...
...
@@ -397,9 +397,11 @@ class ZipFile:
date_time
=
mtime
[
0
:
6
]
# Create ZipInfo instance to store file information
if
arcname
is
None
:
zinfo
=
ZipInfo
(
filename
,
date_time
)
else
:
zinfo
=
ZipInfo
(
arcname
,
date_time
)
arcname
=
filename
arcname
=
os
.
path
.
normpath
(
os
.
path
.
splitdrive
(
arcname
)[
1
])
while
arcname
[
0
]
in
(
os
.
sep
,
os
.
altsep
):
arcname
=
arcname
[
1
:]
zinfo
=
ZipInfo
(
arcname
,
date_time
)
zinfo
.
external_attr
=
(
st
[
0
]
&
0xFFFF
)
<<
16L
# Unix attributes
if
compress_type
is
None
:
zinfo
.
compress_type
=
self
.
compression
...
...
Misc/NEWS
Dosyayı görüntüle @
8f7c54ea
...
...
@@ -372,6 +372,12 @@ Extension Modules
Library
-------
- Bug #1413790: zipfile now sanitizes absolute archive names that are
not allowed by the specs.
- Bug #1413790: zipfile now sanitizes absolute archive names that are
not allowed by the specs.
- Patch #1215184: FileInput now can be given an opening hook which can
be used to control how files are opened.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment