From ff8e9f9ea3c24b1f806d07300c2dd9d1c62d4ebe Mon Sep 17 00:00:00 2001 From: Jarvis Date: Thu, 25 Sep 2025 16:44:46 +0200 Subject: [PATCH] fix(PathUtils): Improve cross-platform absolute path detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace complex heuristic with precise pattern matching for absolute paths: - Unix paths: starts with / - Windows drive letters: C:\ or C:/ using regex /^[a-zA-Z]:[/\\]/ - Windows UNC paths: \\server\share Removes unreliable temp/tmp path indicators and file: URL checks while maintaining fs fallback behavior for proper external file processing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/core/PathUtils.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/core/PathUtils.ts b/src/core/PathUtils.ts index 4d6b16b..c815fe4 100644 --- a/src/core/PathUtils.ts +++ b/src/core/PathUtils.ts @@ -105,17 +105,12 @@ export class PathUtils { } } - // For paths that might be absolute but outside vault, use fs fallback - // This handles external file processing (temp files, system paths, etc.) - // Check for common absolute path indicators across platforms - const isLikelyAbsolutePath = path.startsWith('/') || // Unix absolute - path.startsWith('\\') || // UNC paths - (path.length >= 3 && path[1] === ':') || // Windows drive letter (C:) - path.startsWith('file:') || // File URLs - path.includes('temp') || // Temp directory indicators - path.includes('tmp'); // Common temp paths + // For paths outside vault, use fs fallback (needed for external file processing) + const isAbsolutePath = path.startsWith('/') || // Unix absolute + /^[a-zA-Z]:[/\\]/.test(path) || // Windows drive letter (C:\ or C:/) + path.startsWith('\\\\'); // Windows UNC path (\\server\share) - if (isLikelyAbsolutePath) { + if (isAbsolutePath) { try { const fs = require('fs').promises; await fs.access(path);