From 0706ad78bb5b26671bb6b5e912e81160ab892aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 16 Apr 2026 22:56:46 -0400 Subject: [PATCH] refactor(browser-manager): hoist resolvedRoot out of screenshot filter chain --- src/main/browser-manager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/browser-manager.ts b/src/main/browser-manager.ts index 7c766d7e..c9b5d987 100644 --- a/src/main/browser-manager.ts +++ b/src/main/browser-manager.ts @@ -60,12 +60,12 @@ export class BrowserManager { log.warn(`[browser] Failed to fully clear session for ${socialAccountId}: ${error instanceof Error ? error.message : String(error)}`); } + const resolvedRoot = resolve(this.screenshotDir); await Promise.all( screenshotPaths .filter((entry): entry is string => typeof entry === "string" && entry.length > 0) .filter((screenshotPath) => { const resolvedPath = resolve(screenshotPath); - const resolvedRoot = resolve(this.screenshotDir); return resolvedPath === resolvedRoot || resolvedPath.startsWith(`${resolvedRoot}${sep}`); }) .map((screenshotPath) => rm(screenshotPath, { force: true }).catch(() => undefined)),