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
13e56c73
Kaydet (Commit)
13e56c73
authored
Şub 02, 2013
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix the test and remove trailing dots on Windows for issue #6972.
üst
dc6dc4bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
test_zipfile.py
Lib/test/test_zipfile.py
+14
-8
zipfile.py
Lib/zipfile.py
+4
-1
No files found.
Lib/test/test_zipfile.py
Dosyayı görüntüle @
13e56c73
...
@@ -434,8 +434,6 @@ class TestsWithSourceFile(unittest.TestCase):
...
@@ -434,8 +434,6 @@ class TestsWithSourceFile(unittest.TestCase):
(
'/foo/bar'
,
'foo/bar'
),
(
'/foo/bar'
,
'foo/bar'
),
(
'/foo/../bar'
,
'foo/bar'
),
(
'/foo/../bar'
,
'foo/bar'
),
(
'/foo/../../bar'
,
'foo/bar'
),
(
'/foo/../../bar'
,
'foo/bar'
),
(
'//foo/bar'
,
'foo/bar'
),
(
'../../foo../../ba..r'
,
'foo../ba..r'
),
]
]
if
os
.
path
.
sep
==
'
\\
'
:
if
os
.
path
.
sep
==
'
\\
'
:
hacknames
.
extend
([
hacknames
.
extend
([
...
@@ -447,16 +445,22 @@ class TestsWithSourceFile(unittest.TestCase):
...
@@ -447,16 +445,22 @@ class TestsWithSourceFile(unittest.TestCase):
(
r'C:/foo/bar'
,
'foo/bar'
),
(
r'C:/foo/bar'
,
'foo/bar'
),
(
r'C://foo/bar'
,
'foo/bar'
),
(
r'C://foo/bar'
,
'foo/bar'
),
(
r'C:\foo\bar'
,
'foo/bar'
),
(
r'C:\foo\bar'
,
'foo/bar'
),
(
r'//conky/mountpoint/foo/bar'
,
'foo/bar'
),
(
r'//conky/mountpoint/foo/bar'
,
'
conky/mountpoint/
foo/bar'
),
(
r'\\conky\mountpoint\foo\bar'
,
'foo/bar'
),
(
r'\\conky\mountpoint\foo\bar'
,
'
conky/mountpoint/
foo/bar'
),
(
r'///conky/mountpoint/foo/bar'
,
'conky/mountpoint/foo/bar'
),
(
r'///conky/mountpoint/foo/bar'
,
'conky/mountpoint/foo/bar'
),
(
r'\\\conky\mountpoint\foo\bar'
,
'conky/mountpoint/foo/bar'
),
(
r'\\\conky\mountpoint\foo\bar'
,
'conky/mountpoint/foo/bar'
),
(
r'//conky//mountpoint/foo/bar'
,
'conky/mountpoint/foo/bar'
),
(
r'//conky//mountpoint/foo/bar'
,
'conky/mountpoint/foo/bar'
),
(
r'\\conky\\mountpoint\foo\bar'
,
'conky/mountpoint/foo/bar'
),
(
r'\\conky\\mountpoint\foo\bar'
,
'conky/mountpoint/foo/bar'
),
(
r'//?/C:/foo/bar'
,
'foo/bar'
),
(
r'//?/C:/foo/bar'
,
'
_/C_/
foo/bar'
),
(
r'\\?\C:\foo\bar'
,
'foo/bar'
),
(
r'\\?\C:\foo\bar'
,
'
_/C_/
foo/bar'
),
(
r'C:/../C:/foo/bar'
,
'C_/foo/bar'
),
(
r'C:/../C:/foo/bar'
,
'C_/foo/bar'
),
(
r'a:b\c<d>e|f"g?h*i'
,
'b/c_d_e_f_g_h_i'
),
(
r'a:b\c<d>e|f"g?h*i'
,
'b/c_d_e_f_g_h_i'
),
(
'../../foo../../ba..r'
,
'foo/ba..r'
),
])
else
:
# Unix
hacknames
.
extend
([
(
'//foo/bar'
,
'foo/bar'
),
(
'../../foo../../ba..r'
,
'foo../ba..r'
),
])
])
for
arcname
,
fixedname
in
hacknames
:
for
arcname
,
fixedname
in
hacknames
:
...
@@ -469,7 +473,8 @@ class TestsWithSourceFile(unittest.TestCase):
...
@@ -469,7 +473,8 @@ class TestsWithSourceFile(unittest.TestCase):
with
zipfile
.
ZipFile
(
TESTFN2
,
'r'
)
as
zipfp
:
with
zipfile
.
ZipFile
(
TESTFN2
,
'r'
)
as
zipfp
:
writtenfile
=
zipfp
.
extract
(
arcname
,
targetpath
)
writtenfile
=
zipfp
.
extract
(
arcname
,
targetpath
)
self
.
assertEqual
(
writtenfile
,
correctfile
)
self
.
assertEqual
(
writtenfile
,
correctfile
,
msg
=
"extract
%
r"
%
arcname
)
self
.
check_file
(
correctfile
,
content
)
self
.
check_file
(
correctfile
,
content
)
shutil
.
rmtree
(
'target'
)
shutil
.
rmtree
(
'target'
)
...
@@ -482,7 +487,8 @@ class TestsWithSourceFile(unittest.TestCase):
...
@@ -482,7 +487,8 @@ class TestsWithSourceFile(unittest.TestCase):
with
zipfile
.
ZipFile
(
TESTFN2
,
'r'
)
as
zipfp
:
with
zipfile
.
ZipFile
(
TESTFN2
,
'r'
)
as
zipfp
:
writtenfile
=
zipfp
.
extract
(
arcname
)
writtenfile
=
zipfp
.
extract
(
arcname
)
self
.
assertEqual
(
writtenfile
,
correctfile
)
self
.
assertEqual
(
writtenfile
,
correctfile
,
msg
=
"extract
%
r"
%
arcname
)
self
.
check_file
(
correctfile
,
content
)
self
.
check_file
(
correctfile
,
content
)
shutil
.
rmtree
(
fixedname
.
split
(
'/'
)[
0
])
shutil
.
rmtree
(
fixedname
.
split
(
'/'
)[
0
])
...
...
Lib/zipfile.py
Dosyayı görüntüle @
13e56c73
...
@@ -1050,11 +1050,14 @@ class ZipFile(object):
...
@@ -1050,11 +1050,14 @@ class ZipFile(object):
arcname
=
os
.
path
.
splitdrive
(
arcname
)[
1
]
arcname
=
os
.
path
.
splitdrive
(
arcname
)[
1
]
arcname
=
os
.
path
.
sep
.
join
(
x
for
x
in
arcname
.
split
(
os
.
path
.
sep
)
arcname
=
os
.
path
.
sep
.
join
(
x
for
x
in
arcname
.
split
(
os
.
path
.
sep
)
if
x
not
in
(
''
,
os
.
path
.
curdir
,
os
.
path
.
pardir
))
if
x
not
in
(
''
,
os
.
path
.
curdir
,
os
.
path
.
pardir
))
# filter illegal characters on Windows
if
os
.
path
.
sep
==
'
\\
'
:
if
os
.
path
.
sep
==
'
\\
'
:
# filter illegal characters on Windows
illegal
=
':<>|"?*'
illegal
=
':<>|"?*'
table
=
string
.
maketrans
(
illegal
,
'_'
*
len
(
illegal
))
table
=
string
.
maketrans
(
illegal
,
'_'
*
len
(
illegal
))
arcname
=
arcname
.
translate
(
table
)
arcname
=
arcname
.
translate
(
table
)
# remove trailing dots
arcname
=
(
x
.
rstrip
(
'.'
)
for
x
in
arcname
.
split
(
os
.
path
.
sep
))
arcname
=
os
.
path
.
sep
.
join
(
x
for
x
in
arcname
if
x
)
targetpath
=
os
.
path
.
join
(
targetpath
,
arcname
)
targetpath
=
os
.
path
.
join
(
targetpath
,
arcname
)
targetpath
=
os
.
path
.
normpath
(
targetpath
)
targetpath
=
os
.
path
.
normpath
(
targetpath
)
...
...
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