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
9bdb7be4
Unverified
Kaydet (Commit)
9bdb7be4
authored
Eyl 17, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Eyl 17, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-34341: Fix appending to ZIP archives with the ZIP64 extension. (GH-8683)
üst
da8d72c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
0 deletions
+38
-0
test_zipfile.py
Lib/test/test_zipfile.py
+14
-0
zipfile.py
Lib/zipfile.py
+22
-0
2018-08-06-11-01-18.bpo-34341.E0b9p2.rst
...S.d/next/Library/2018-08-06-11-01-18.bpo-34341.E0b9p2.rst
+2
-0
No files found.
Lib/test/test_zipfile.py
Dosyayı görüntüle @
9bdb7be4
...
...
@@ -770,6 +770,20 @@ class StoredTestZip64InSmallFiles(AbstractTestZip64InSmallFiles,
with
zipfile
.
ZipFile
(
TESTFN2
,
"r"
,
zipfile
.
ZIP_STORED
)
as
zipfp
:
self
.
assertEqual
(
zipfp
.
namelist
(),
[
"absolute"
])
def
test_append
(
self
):
# Test that appending to the Zip64 archive doesn't change
# extra fields of existing entries.
with
zipfile
.
ZipFile
(
TESTFN2
,
"w"
,
allowZip64
=
True
)
as
zipfp
:
zipfp
.
writestr
(
"strfile"
,
self
.
data
)
with
zipfile
.
ZipFile
(
TESTFN2
,
"r"
,
allowZip64
=
True
)
as
zipfp
:
zinfo
=
zipfp
.
getinfo
(
"strfile"
)
extra
=
zinfo
.
extra
with
zipfile
.
ZipFile
(
TESTFN2
,
"a"
,
allowZip64
=
True
)
as
zipfp
:
zipfp
.
writestr
(
"strfile2"
,
self
.
data
)
with
zipfile
.
ZipFile
(
TESTFN2
,
"r"
,
allowZip64
=
True
)
as
zipfp
:
zinfo
=
zipfp
.
getinfo
(
"strfile"
)
self
.
assertEqual
(
zinfo
.
extra
,
extra
)
@requires_zlib
class
DeflateTestZip64InSmallFiles
(
AbstractTestZip64InSmallFiles
,
unittest
.
TestCase
):
...
...
Lib/zipfile.py
Dosyayı görüntüle @
9bdb7be4
...
...
@@ -159,6 +159,27 @@ _CD64_NUMBER_ENTRIES_TOTAL = 7
_CD64_DIRECTORY_SIZE
=
8
_CD64_OFFSET_START_CENTDIR
=
9
_EXTRA_FIELD_STRUCT
=
struct
.
Struct
(
'<HH'
)
def
_strip_extra
(
extra
,
xids
):
# Remove Extra Fields with specified IDs.
unpack
=
_EXTRA_FIELD_STRUCT
.
unpack
modified
=
False
buffer
=
[]
start
=
i
=
0
while
i
+
4
<=
len
(
extra
):
xid
,
xlen
=
unpack
(
extra
[
i
:
i
+
4
])
j
=
i
+
4
+
xlen
if
xid
in
xids
:
if
i
!=
start
:
buffer
.
append
(
extra
[
start
:
i
])
start
=
j
modified
=
True
i
=
j
if
not
modified
:
return
extra
return
b
''
.
join
(
buffer
)
def
_check_zipfile
(
fp
):
try
:
if
_EndRecData
(
fp
):
...
...
@@ -1819,6 +1840,7 @@ class ZipFile:
min_version
=
0
if
extra
:
# Append a ZIP64 field to the extra's
extra_data
=
_strip_extra
(
extra_data
,
(
1
,))
extra_data
=
struct
.
pack
(
'<HH'
+
'Q'
*
len
(
extra
),
1
,
8
*
len
(
extra
),
*
extra
)
+
extra_data
...
...
Misc/NEWS.d/next/Library/2018-08-06-11-01-18.bpo-34341.E0b9p2.rst
0 → 100644
Dosyayı görüntüle @
9bdb7be4
Appending to the ZIP archive with the ZIP64 extension no longer grows the
size of extra fields of existing entries.
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