Skip to content

Commit 1ff95cb

Browse files
committed
Add reproducible of issue 404
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
1 parent e840371 commit 1ff95cb

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/data/github_404.zip

95 KB
Binary file not shown.

tests/test_archive.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import shutil
1010
import stat
1111
import sys
12+
import zipfile
1213
from datetime import datetime
1314

1415
import pytest
@@ -1123,3 +1124,25 @@ def test_compress_append_archive_w_zerofile(tmp_path):
11231124
#
11241125
with py7zr.SevenZipFile(target, "r") as arc:
11251126
arc.extractall(path=tmp_path / "tgt")
1127+
1128+
1129+
@pytest.mark.basic
1130+
def test_compress_file_append_dir(tmp_path):
1131+
srcpath = tmp_path.joinpath("src")
1132+
srcpath.mkdir()
1133+
with zipfile.ZipFile(pathlib.Path(testdata_path).joinpath("github_404.zip")) as zipsrc:
1134+
zipsrc.extractall(path=srcpath)
1135+
target = tmp_path.joinpath("target.7z")
1136+
with py7zr.SevenZipFile(target, "w") as archive:
1137+
archive.write(srcpath.joinpath("a.xlsx"), arcname="a.xlsx")
1138+
archive = py7zr.SevenZipFile(target, "a")
1139+
archive.set_encoded_header_mode(False)
1140+
archive.writeall(srcpath.joinpath("22"), arcname="22")
1141+
assert len(archive.files.files_list) == 8
1142+
archive.close()
1143+
#
1144+
p7zip_test(target)
1145+
libarchive_extract(target, tmp_path.joinpath("tgt2"))
1146+
#
1147+
with py7zr.SevenZipFile(target, "r") as arc:
1148+
arc.extractall(path=tmp_path / "tgt")

0 commit comments

Comments
 (0)