diff --git a/api/extensions/storage/opendal_storage.py b/api/extensions/storage/opendal_storage.py index 98f646f4f9..ee8cfa9179 100644 --- a/api/extensions/storage/opendal_storage.py +++ b/api/extensions/storage/opendal_storage.py @@ -71,15 +71,8 @@ class OpenDALStorage(BaseStorage): logger.debug(f"file {filename} downloaded to {target_filepath}") def exists(self, filename: str) -> bool: - # FIXME this is a workaround for opendal python-binding do not have a exists method and no better - # error handler here when opendal python-binding has a exists method, we should use it - # more https://github.com/apache/opendal/blob/main/bindings/python/src/operator.rs - try: - res: bool = self.op.stat(path=filename).mode.is_file() - logger.debug(f"file {filename} checked") - return res - except Exception: - return False + res: bool = self.op.exists(path=filename) + return res def delete(self, filename: str): if self.exists(filename): diff --git a/api/poetry.lock b/api/poetry.lock index ffa5810982..1cb05b1789 100644 --- a/api/poetry.lock +++ b/api/poetry.lock @@ -10228,4 +10228,4 @@ cffi = ["cffi (>=1.11)"] [metadata] lock-version = "2.1" python-versions = ">=3.11,<3.13" -content-hash = "8e6eaed521da966cfcdb5400e9d3aedb7623b5ac6a8da428d9f984af22542cce" +content-hash = "5ed3febffb932561050bba56b04bd03ffec7d54a7d26b95ad42c55ef45e07fae" diff --git a/api/pyproject.toml b/api/pyproject.toml index 493bfa240b..eb7313449a 100644 --- a/api/pyproject.toml +++ b/api/pyproject.toml @@ -105,7 +105,7 @@ bce-python-sdk = "~0.9.23" cos-python-sdk-v5 = "1.9.30" esdk-obs-python = "3.24.6.1" google-cloud-storage = "2.16.0" -opendal = "~0.45.12" +opendal = "~0.45.16" oss2 = "2.18.5" supabase = "~2.8.1" tos = "~2.7.1"