From 99408d3cec053879bfec23c9d9261f1b89991284 Mon Sep 17 00:00:00 2001 From: sunlei Date: Thu, 25 Jun 2026 00:30:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E5=BC=BANapCat=E5=AE=A1?= =?UTF-8?q?=E8=AE=A1Windows=E8=B7=AF=E5=BE=84=E6=8B=92=E7=BB=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/selfTest.ts | 12 ++++++++++++ src/tools/napcatAutomation.ts | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/selfTest.ts b/src/selfTest.ts index afdd95d..7ad3b75 100644 --- a/src/selfTest.ts +++ b/src/selfTest.ts @@ -182,6 +182,18 @@ export async function runSelfTest(): Promise { "\\\\server\\share\\packages\\napcat-core\\login\\runtime.ts", ], }, + { + forkPatchFiles: [], + name: "Windows rooted path", + upstreamChangedFiles: [ + "\\packages\\napcat-core\\login\\runtime.ts", + ], + }, + { + forkPatchFiles: [], + name: "Windows drive-relative path", + upstreamChangedFiles: ["C:packages/napcat-core/login/runtime.ts"], + }, { forkPatchFiles: [], name: "parent segment path", diff --git a/src/tools/napcatAutomation.ts b/src/tools/napcatAutomation.ts index 2cf0be5..337ee25 100644 --- a/src/tools/napcatAutomation.ts +++ b/src/tools/napcatAutomation.ts @@ -83,9 +83,9 @@ const hotZoneMatchers: Array<{ pattern: string; regex: RegExp }> = [ function hasInvalidAuditPath(value: string): boolean { const trimmed = value.trim(); if (!trimmed) return false; - if (/^[a-zA-Z]:[\\/]/.test(trimmed)) return true; + if (/^[a-zA-Z]:/.test(trimmed)) return true; if (trimmed.startsWith('\\\\') || trimmed.startsWith('//')) return true; - if (trimmed.startsWith('/')) return true; + if (trimmed.startsWith('\\') || trimmed.startsWith('/')) return true; const normalized = trimmed .replace(/\\/g, '/')