szip: fix panic on empty files (#24335)

This commit is contained in:
JalonSolov 2025-04-29 02:07:09 -04:00 committed by GitHub
parent 57b815f96d
commit 8fc7aeca38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -170,3 +170,11 @@ fn test_zip_folder_omit_empty_directories() {
assert (os.read_file(fpath5)!) == '5'
assert (os.read_file(fpath6)!) == '6'
}
fn test_zip_folder_empty_file() {
cleanup()
os.mkdir_all(test_path)!
os.write_file('${test_path}/test.txt', '')! // Empty file
szip.zip_folder(test_path, test_dir_zip)!
assert os.exists(test_dir_zip)
}