Skip to content

Commit b824f2d

Browse files
committed
safer popping
1 parent dadc642 commit b824f2d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

flytekit/remote/remote_fs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ async def _put_file(
145145
"""
146146
prefix = kwargs.pop(_PREFIX_KEY)
147147
lpath = pathlib.Path(lpath)
148-
relative_subdirectory = str(lpath.parent.relative_to(pathlib.Path(kwargs.pop(_LPATH_ROOT_KEY))))
149-
if relative_subdirectory != ".":
150-
prefix += "/" + relative_subdirectory
148+
if _LPATH_ROOT_KEY in kwargs:
149+
lpath_root = pathlib.Path(kwargs.pop(_LPATH_ROOT_KEY))
150+
relative_subdirectory = str(lpath.parent.relative_to(lpath_root))
151+
if relative_subdirectory != ".":
152+
prefix += "/" + relative_subdirectory
151153
_, native_url = self._remote.upload_file(
152154
lpath, self._remote.default_project, self._remote.default_domain, prefix
153155
)

0 commit comments

Comments
 (0)