File: 47.patch

package info (click to toggle)
python-handy-archives 0.2.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,396 kB
  • sloc: python: 4,154; makefile: 5
file content (32 lines) | stat: -rw-r--r-- 1,430 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From bfb369a93bc3c29376a3c11023edabc30b5da918 Mon Sep 17 00:00:00 2001
From: Marcel Telka <marcel@telka.sk>
Date: Wed, 12 Nov 2025 09:06:59 +0100
Subject: [PATCH] Fix Zip64 end of central directory locator in
 make_zip64_file()

---
 tests/test_zipfile.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/test_zipfile.py b/tests/test_zipfile.py
index da81e75..a72eaad 100644
--- a/tests/test_zipfile.py
+++ b/tests/test_zipfile.py
@@ -1071,6 +1071,8 @@ def make_zip64_file(
 		local_extra_length = struct.pack("<H", 4 + 8 * len(local_zip64_fields))
 		central_extra_length = struct.pack("<H", 4 + 8 * len(central_zip64_fields))
 
+		relative_offset_eocd = struct.pack("<Q", 108 + 8 * (len(central_zip64_fields) + len(local_zip64_fields)))
+
 		filename = b"test.txt"
 		content = b"test1234"
 		filename_length = struct.pack("<H", len(filename))
@@ -1087,7 +1089,7 @@ def make_zip64_file(
 				+ b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00"
 				+ b"\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00" + central_dir_size + offset_to_central_dir
 				# Zip64 end of central directory locator
-				+ b"PK\x06\x07\x00\x00\x00\x00l\x00\x00\x00\x00\x00\x00\x00\x01" + b"\x00\x00\x00"
+				+ b"PK\x06\x07\x00\x00\x00\x00" + relative_offset_eocd + b"\x01\x00\x00\x00"
 				# end of central directory
 				+ b"PK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00:\x00\x00\x002\x00" + b"\x00\x00\x00\x00"
 				)