File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,16 @@ def write_content_to_zip(
287287 else :
288288 reader = get_reader (file )
289289
290+ if (
291+ isinstance (reader .original_root , ZipFile )
292+ and reader .original_root .filename == zip .filename
293+ and reader .original_file_name == arc_name
294+ ):
295+ logger .debug (
296+ f"Not copying { reader .original_root } /{ reader .original_file_name } to itself."
297+ )
298+ continue
299+
290300 with zip .open (arc_name , "w" ) as dest :
291301 shutil .copyfileobj (reader , dest , 1024 * 8 )
292302
Original file line number Diff line number Diff line change @@ -188,6 +188,13 @@ def save_bioimageio_package_as_folder(
188188 for name , src in package_content .items ():
189189 if isinstance (src , collections .abc .Mapping ):
190190 write_yaml (src , output_path / name )
191+ elif (
192+ isinstance (src .original_root , Path )
193+ and src .original_root / src .original_file_name == output_path / name
194+ ):
195+ logger .debug (
196+ f"Not copying { src .original_root / src .original_file_name } to itself."
197+ )
191198 else :
192199 with (output_path / name ).open ("wb" ) as dest :
193200 _ = shutil .copyfileobj (src , dest )
You can’t perform that action at this time.
0 commit comments