Skip to content

Commit

Permalink
move calling absolute path in client side
Browse files Browse the repository at this point in the history
  • Loading branch information
jiexiong2016 committed Jan 29, 2024
1 parent 09b0acd commit 1a3418f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions nos/client/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ def _delete_file(self, path: Path) -> None:
@contextlib.contextmanager
def UploadFile(self, path: Path, chunk_size: int = 4 * MB_BYTES) -> Path:
"""Upload a file to the server, and delete it after use."""
path = path.absolute()
if not path.exists():
raise FileNotFoundError(f"File not found [path={path}]")
try:
Expand Down
2 changes: 1 addition & 1 deletion nos/server/_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def UploadFile(self, request_iterator: Any, context: grpc.ServicerContext) -> no
for _chunk_idx, chunk_request in enumerate(request_iterator):
chunk = loads(chunk_request.request_bytes)
chunk_bytes = chunk["chunk_bytes"]
path = Path(chunk["filename"]).absolute()
path = Path(chunk["filename"])
if str(path) not in self._tmp_files:
tmp_file = NamedTemporaryFile(delete=False, dir="/tmp", suffix=path.suffix)
self._tmp_files[str(path)] = tmp_file
Expand Down

0 comments on commit 1a3418f

Please sign in to comment.