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):
29
29
30
30
Private Attributes:
31
31
_size (int): Size of the file in bytes.
32
+ _is_inside_zip (bool): Indicates if the file is packaged inside a zip archive.
32
33
33
34
Methods:
34
35
extract_file_name(): Extracts filename from filepath and initializes file handler.
@@ -57,6 +58,7 @@ class File(BaseModel):
57
58
tab_ingest : bool = Field (default = True , alias = "tabIngest" )
58
59
59
60
_size : int = PrivateAttr (default = 0 )
61
+ _is_inside_zip : bool = PrivateAttr (default = False )
60
62
61
63
def extract_file_name (self ):
62
64
"""
Original file line number Diff line number Diff line change @@ -345,8 +345,8 @@ async def _update_metadata(
345
345
try :
346
346
if _tab_extension (dv_path ) in file_mapping :
347
347
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
350
350
# the expected file name of the zip will not be in the
351
351
# dataset, since it has been unpacked.
352
352
continue
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ def zip_files(
98
98
data = file .handler .read (), # type: ignore
99
99
zinfo_or_arcname = _create_arcname (file ),
100
100
)
101
+ file ._is_inside_zip = True
101
102
102
103
return path
103
104
You can’t perform that action at this time.
0 commit comments