8000 Enabling Zip64 Extension to support zipfile >- 2GB. (#144) · nachtgold/document-api-python@c7a2926 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7a2926

Browse files
doulamt8y8
authored andcommitted
Enabling Zip64 Extension to support zipfile >- 2GB. (tableau#144)
Python itself made this the default in 3.4. This will cover anyone on 2.7 or 3.3 (https://bugs.python.org/issue17201)
1 parent 562a54e commit c7a2926

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tableaudocumentapi/xfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def find_file_in_zip(zip_file):
7575

7676

7777
def get_xml_from_archive(filename):
78-
with zipfile.ZipFile(filename) as zf:
78+
with zipfile.ZipFile(filename, allowZip64=True) as zf:
7979
with zf.open(find_file_in_zip(zf)) as xml_file:
8080
xml_tree = ET.parse(xml_file)
8181

@@ -107,15 +107,15 @@ def save_into_archive(xml_tree, filename, new_filename=None):
107107

108108
# Extract to temp directory
109109
with temporary_directory() as temp_path:
110-
with zipfile.ZipFile(filename) as zf:
110+
with zipfile.ZipFile(filename, allowZip64=True) as zf:
111111
xml_file = find_file_in_zip(zf)
112112
zf.extractall(temp_path)
113113
# Write the new version of the file to the temp directory
114114
xml_tree.write(os.path.join(
115115
temp_path, xml_file), encoding="utf-8", xml_declaration=True)
116116

117117
# Write the new archive with the contents of the temp folder
118-
with zipfile.ZipFile(new_filename, "w", compression=zipfile.ZIP_DEFLATED) as new_archive:
118+
with zipfile.ZipFile(new_filename, "w", compression=zipfile.ZIP_DEFLATED, allowZip64=True) as new_archive:
119119
build_archive_file(temp_path, new_archive)
120120

121121

0 commit comments

Comments
 (0)
0