diff --git a/api/commands.py b/api/commands.py index e15c996a34..a8d89ac200 100644 --- a/api/commands.py +++ b/api/commands.py @@ -1139,6 +1139,7 @@ def remove_orphaned_files_on_storage(force: bool): click.echo(click.style(f"Found {len(all_files_in_tables)} files in tables.", fg="white")) except Exception as e: click.echo(click.style(f"Error fetching keys: {str(e)}", fg="red")) + return all_files_on_storage = [] for storage_path in storage_paths: diff --git a/api/extensions/storage/opendal_storage.py b/api/extensions/storage/opendal_storage.py index f7146adba6..a084844d72 100644 --- a/api/extensions/storage/opendal_storage.py +++ b/api/extensions/storage/opendal_storage.py @@ -87,7 +87,7 @@ class OpenDALStorage(BaseStorage): if not self.exists(path): raise FileNotFoundError("Path not found") - all_files = self.op.list(path=path) + all_files = self.op.scan(path=path) if files and directories: logger.debug("files and directories on %s scanned", path) return [f.path for f in all_files]