From d66dceae16b86142daea0a0f84df0c5d9b1c54e3 Mon Sep 17 00:00:00 2001 From: kurokobo Date: Mon, 8 Dec 2025 10:48:05 +0900 Subject: [PATCH] fix: make remove-orphaned-files-on-storage management command work and safer (#29247) --- api/commands.py | 1 + api/extensions/storage/opendal_storage.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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]