fixed bug to resolve local files for recursive file upload.
This commit is contained in:
@ -32,7 +32,7 @@ class FilesApi(BaseApi):
|
||||
token_check(self.connection)
|
||||
data: dict[str, str | int] = {"folder_id": folder_id}
|
||||
try:
|
||||
with open(os.path.relpath(path), mode="rb") as fp:
|
||||
with open(os.path.realpath(path), mode="rb") as fp:
|
||||
response = self.connection.post(url, data=data, files={"file": fp})
|
||||
self._raise_response_error(response)
|
||||
ret = TypeAdapter(FilesApiCreateResponse).validate_python(response.json())
|
||||
@ -47,7 +47,7 @@ class FilesApi(BaseApi):
|
||||
if path is not None:
|
||||
# update file body
|
||||
try:
|
||||
with open(os.path.relpath(path), mode="rb") as fp:
|
||||
with open(os.path.realpath(path), mode="rb") as fp:
|
||||
response = self.connection.put(url, files={"file": fp})
|
||||
except OSError:
|
||||
raise UnexpectedException(f"Could not open `{path}` file.")
|
||||
|
Reference in New Issue
Block a user