From c063eae7fbfe5082cbd7c5497f9976b5b811e868 Mon Sep 17 00:00:00 2001 From: Pim de Haan Date: Wed, 13 Nov 2024 15:33:25 +0100 Subject: [PATCH] Fix issue in FlyteDirectory.listdir Fixes flyteorg/flyte#6005 Signed-off-by: Pim de Haan --- flytekit/types/directory/types.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flytekit/types/directory/types.py b/flytekit/types/directory/types.py index a7c0aacc83..fa77a75e98 100644 --- a/flytekit/types/directory/types.py +++ b/flytekit/types/directory/types.py @@ -367,10 +367,11 @@ def listdir(cls, directory: FlyteDirectory) -> typing.List[typing.Union[FlyteDir file_access = FlyteContextManager.current_context().file_access if not file_access.is_remote(final_path): for p in os.listdir(final_path): - if os.path.isfile(os.path.join(final_path, p)): - paths.append(FlyteFile(p)) + joined_path = os.path.join(final_path, p) + if os.path.isfile(joined_path): + paths.append(FlyteFile(joined_path)) else: - paths.append(FlyteDirectory(p)) + paths.append(FlyteDirectory(joined_path)) return paths def create_downloader(_remote_path: str, _local_path: str, is_multipart: bool):