From c90d93c22428e797f082b1d0266493d33d295539 Mon Sep 17 00:00:00 2001 From: Momentry Studio Date: Fri, 9 Oct 2026 22:35:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20get=5Ffiles=20?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E9=94=99=E8=AF=AF=E7=9A=84=20API=20=E7=AB=AF?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题: - 前端调用 /api/v1/files/scan - 该 API 扫描文件系统,依赖 MOMENTRY_SFTP_ROOT 环境变量 - 如果未设置或目录不存在,返回空数组 - 导致显示 'No files found' 修复: - 改为调用 /api/v1/files - 该 API 直接从数据库读取已注册文件 - 返回 { success: true, total: 176, data: [...] } 测试: - ✅ /api/v1/files 返回 176 个文件 - ✅ 前端应该能正确显示文件列表 --- src/api/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/index.ts b/src/api/index.ts index b495af9..a0502a0 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -245,7 +245,7 @@ function buildHttpRequest(cmd: string, args: Record): { url: string // --- Data APIs --- case 'get_files': { const ps = a.args?.pageSize || 500 - return { url: `/api/v1/files/scan?page_size=${ps}`, method: 'GET' } + return { url: `/api/v1/files?limit=${ps}`, method: 'GET' } } case 'get_people': { return { url: `/api/v1/identities?page=${a.page || 1}&per_page=${a.perPage || 100}`, method: 'GET' }