From 8bc7201783227fc607a645b8efa3eb3f6ba1510b Mon Sep 17 00:00:00 2001 From: chengkai3 Date: Sun, 28 Jun 2026 20:34:46 +0800 Subject: [PATCH] =?UTF-8?q?[fix]:[FL-216][ATP=E6=A8=A1=E5=9E=8B=E7=AE=A1?= =?UTF-8?q?=E7=90=86:=20=E5=8E=BB=E6=8E=89=E7=89=88=E6=9C=AC=E6=A6=82?= =?UTF-8?q?=E5=BF=B5=EF=BC=8C=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=B1=95=E7=A4=BA]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: multica-agent --- api/app/services/atp_asset_service.py | 15 ++++++++++++++- api/tests/test_atp_asset_service.py | 4 ++-- web/src/types/auth.ts | 2 -- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/api/app/services/atp_asset_service.py b/api/app/services/atp_asset_service.py index c985254..a84e0ab 100644 --- a/api/app/services/atp_asset_service.py +++ b/api/app/services/atp_asset_service.py @@ -1512,7 +1512,20 @@ def list_asset_files(db: Session, *, asset_id: str) -> AtpAssetFileListResponse: storage_mount_code, storage_root_path = _resolve_asset_file_location(db, asset, allow_legacy_release_root=True) mount = _resolve_mount(db, storage_mount_code) driver = _build_driver_or_400(mount) - tree = _walk_storage_tree(driver, storage_root_path) + try: + tree = _walk_storage_tree(driver, storage_root_path) + except HTTPException as exc: + if exc.status_code != status.HTTP_404_NOT_FOUND: + raise + fallback_release = db.execute( + select(AtpAssetRelease) + .options(joinedload(AtpAssetRelease.asset)) + .where(AtpAssetRelease.asset_id == asset.id) + .order_by(AtpAssetRelease.is_active.desc(), AtpAssetRelease.release_no.desc(), AtpAssetRelease.id.desc()) + ).scalars().first() + if fallback_release: + return list_release_files(db, release_id=fallback_release.id) + tree = StorageTree(files=[], directories=[], file_paths=set(), dir_paths=set(), max_depth=0) items = [ AtpAssetFileEntry( relative_path=_relative_from_root(storage_root_path, item.path), diff --git a/api/tests/test_atp_asset_service.py b/api/tests/test_atp_asset_service.py index 4e4dfc8..b537905 100644 --- a/api/tests/test_atp_asset_service.py +++ b/api/tests/test_atp_asset_service.py @@ -269,7 +269,7 @@ def test_upload_asset_archive_and_list_asset_files(tmp_path) -> None: ) assert uploaded.success is True - assert uploaded.storage_root_path == f"/atp-library/assets/{asset.id}" + assert uploaded.storage_root_path == "/atp-assets/ATP-ASSET-DIRECT-UPLOAD" files = atp_asset_service.list_asset_files(session, asset_id=asset.id) assert files.asset_id == asset.id @@ -504,7 +504,7 @@ def test_upload_asset_files_extracts_zip_and_removes_asset_root(tmp_path) -> Non assert (asset_root / "nested" / "config.txt").exists() files = atp_asset_service.list_asset_files(session, asset_id=asset.id) - assert files.release_id == asset.id + assert files.release_id is None assert files.storage_root_path == "/atp-assets/ATP-ASSET-FILES" assert any(entry.relative_path == "work.atp" and not entry.is_dir for entry in files.items) assert any(entry.relative_path == "nested/config.txt" and not entry.is_dir for entry in files.items) diff --git a/web/src/types/auth.ts b/web/src/types/auth.ts index f420230..ef39e60 100644 --- a/web/src/types/auth.ts +++ b/web/src/types/auth.ts @@ -925,8 +925,6 @@ export type AtpAssetSummary = { active_release_no: number | null; active_release_id: string | null; active_release_tag: string | null; - storage_mount_code: string | null; - storage_root_path: string | null; release_count: number; run_count: number; last_run_status: AtpAssetRunStatus | null;