Skip to content

Commit 52bd88e

Browse files
committed
don't treat top level file as directory
1 parent d42b08d commit 52bd88e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lsp_utils/_util/download_file.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ def extract_files_from_archive(archive: ZipFile | tarfile.TarFile, target_direct
5151
raise Exception(msg)
5252
topdir_name = get_top_level_directory(names)
5353
archive.extractall(str(target_directory)) # noqa: S202
54-
return target_directory / topdir_name if topdir_name else None
54+
topdir_path = target_directory / topdir_name if topdir_name else None
55+
if topdir_path and topdir_path.is_dir():
56+
return topdir_path
57+
return None
5558

5659

5760
def get_top_level_directory(names: list[str]) -> str | None:

0 commit comments

Comments
 (0)