File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed
Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class File(BaseModel):
2929
3030 Private Attributes:
3131 _size (int): Size of the file in bytes.
32+ _is_inside_zip (bool): Indicates if the file is packaged inside a zip archive.
3233
3334 Methods:
3435 extract_file_name(): Extracts filename from filepath and initializes file handler.
@@ -57,6 +58,7 @@ class File(BaseModel):
5758 tab_ingest : bool = Field (default = True , alias = "tabIngest" )
5859
5960 _size : int = PrivateAttr (default = 0 )
61+ _is_inside_zip : bool = PrivateAttr (default = False )
6062
6163 def extract_file_name (self ):
6264 """
Original file line number Diff line number Diff line change @@ -345,8 +345,8 @@ async def _update_metadata(
345345 try :
346346 if _tab_extension (dv_path ) in file_mapping :
347347 file_id = file_mapping [_tab_extension (dv_path )]
348- elif file .file_name and _is_zip (file .file_name ):
349- # When the file is a zip it will be unpacked and thus
348+ elif file .file_name and _is_zip (file .file_name ) and not file . _is_inside_zip :
349+ # When the file is a zip package it will be unpacked and thus
350350 # the expected file name of the zip will not be in the
351351 # dataset, since it has been unpacked.
352352 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