From ee136b65288407344208722a51acb0961d2bd028 Mon Sep 17 00:00:00 2001 From: Pikachu Bot Date: Sun, 11 Oct 2026 13:53:24 +0800 Subject: [PATCH] fix(139,fs): throw on missing folder path segment; don't cache Virtual results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. drivers/139/driver.ts — resolveCatalogId() used `break` when a path segment was not found in the folder listing, silently returning the last successfully resolved catalogId (typically the root). list() and get() then appeared to succeed but returned root directory contents for any path whose intermediate folder could not be matched, producing the 'always shows root' symptom. Changed to `throw` with a message that includes the missing segment and full path so misconfigured account types are immediately visible in logs. 2. server/fs.ts — when resolvePath() returns isVirtual=true the storage object is null and cacheExpiration was set to `undefined`. The front end interprets undefined as a non-zero TTL and caches the Virtual result; subsequent requests hit the cache and keep showing the Virtual provider even after the real storage comes online. Fixed by returning 0 for Virtual paths so the front end never caches them. --- src/backend/drivers/139/driver.ts | 4 +++- src/backend/server/fs.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/drivers/139/driver.ts b/src/backend/drivers/139/driver.ts index 70241b42..78f7e33c 100644 --- a/src/backend/drivers/139/driver.ts +++ b/src/backend/drivers/139/driver.ts @@ -50,7 +50,9 @@ export class Yun139Driver implements StorageDriver { if (foundFolder) { currentCatalogId = foundFolder.catalogID } else { - break + throw new Error( + `[139] folder not found: "${part}" in path "${physicalPath}"`, + ) } } diff --git a/src/backend/server/fs.ts b/src/backend/server/fs.ts index ac90cef6..c35cb812 100644 --- a/src/backend/server/fs.ts +++ b/src/backend/server/fs.ts @@ -440,7 +440,9 @@ fsRouter.post("/list", async (c) => { // 对齐 Go 的路径级缓存策略;前端/上层可据此决定该目录的列表缓存时长。 const cacheExpiration = storage ? resolveCacheExpiration(storage, reqPath) - : undefined + : 0 // Virtual directories must not be cached; a cached Virtual result + // would persist after the real storage comes online, causing the + // 'always shows root / Virtual provider' symptom for subsequent requests. return c.json({ code: 200, message: "success",