FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

#141 - Enabling Zip64 Extension to support zipfile >- 2GB. by doulam · Pull Request #144 · tableau/document-api-python · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 3 additions & 3 deletions tableaudocumentapi/xfile.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def find_file_in_zip(zip_file):


def get_xml_from_archive(filename):
with zipfile.ZipFile(filename) as zf:
with zipfile.ZipFile(filename, allowZip64=True) as zf:
with zf.open(find_file_in_zip(zf)) as xml_file:
xml_tree = ET.parse(xml_file)

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

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

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


Expand Down

Back | FazBrowse Home | New Git URL