File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ class File(BaseModel):
3030 Private Attributes:
3131 _size (int): Size of the file in bytes.
3232 _unchanged_data (bool): Indicates if the file data has not changed since last upload.
33+ _is_inside_zip (bool): Indicates if the file is packaged inside a zip archive.
3334
3435 Methods:
3536 extract_file_name(): Extracts filename from filepath and initializes file handler.
@@ -59,6 +60,7 @@ class File(BaseModel):
5960
6061 _size : int = PrivateAttr (default = 0 )
6162 _unchanged_data : bool = PrivateAttr (default = False )
63+ _is_inside_zip : bool = PrivateAttr (default = False )
6264
6365 def extract_file_name (self ):
6466 """
Original file line number Diff line number Diff line change @@ -369,8 +369,8 @@ async def _update_metadata(
369369 try :
370370 if _tab_extension (dv_path ) in file_mapping :
371371 file_id = file_mapping [_tab_extension (dv_path )]
372- elif file .file_name and _is_zip (file .file_name ):
373- # When the file is a zip it will be unpacked and thus
372+ elif file .file_name and _is_zip (file .file_name ) and not file . _is_inside_zip :
373+ # When the file is a zip package it will be unpacked and thus
374374 # the expected file name of the zip will not be in the
375375 # dataset, since it has been unpacked.
376376 continue
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ def zip_files(
9898 data = file .handler .read (), # type: ignore
9999 zinfo_or_arcname = _create_arcname (file ),
100100 )
101+ file ._is_inside_zip = True
101102
102103 return path
103104
You can’t perform that action at this time.
0 commit comments