Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
zipfiles
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
9a69fa65
authored
2020-03-20 18:16:03 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix decode bug
1 parent
5aef6b62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
zipfiles/__init__.py
zipfiles/__init__.py
View file @
9a69fa6
...
...
@@ -1210,11 +1210,11 @@ class ZipFile:
filename
=
filename
.
decode
(
'utf-8'
)
else
:
# Historical ZIP filename encoding
filename
=
filename
.
decode
(
'cp437'
)
#
filename = filename.decode('cp437')
try
:
filename
=
filename
.
encode
(
"cp437"
)
.
decode
(
'gbk
'
)
filename
=
filename
.
decode
(
'utf-8
'
)
except
:
pass
filename
=
filename
.
decode
(
"gbk"
)
# Create ZipInfo instance to store file information
x
=
ZipInfo
(
filename
)
x
.
extra
=
fp
.
read
(
centdir
[
_CD_EXTRA_FIELD_LENGTH
])
...
...
@@ -1392,11 +1392,11 @@ class ZipFile:
# UTF-8 filename
fname_str
=
fname
.
decode
(
"utf-8"
)
else
:
fname_str
=
fname
.
decode
(
"cp437"
)
#
fname_str = fname.decode("cp437")
try
:
fname_str
=
fname
_str
.
encode
(
"cp437"
)
.
decode
(
'gbk'
)
fname_str
=
fname
.
decode
(
"utf-8"
)
except
:
pass
fname_str
=
fname
.
decode
(
"gbk"
)
if
fname_str
!=
zinfo
.
orig_filename
:
raise
BadZipFile
(
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment