From 4e3ef6ce9c0d7207ff72672b80d3269f3959ee01 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Thu, 25 Sep 2025 16:26:11 +0200 Subject: [PATCH] fix(PathUtils): Improve cross-platform absolute path detection without Node.js path module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replaced problematic heuristic path.includes('/') && !path.startsWith('.') - Added explicit checks for Windows drive letters (C:), UNC paths, and Unix absolute paths - Enhanced detection for temp directories and file URLs across platforms - Maintains Obsidian API-first approach without importing Node.js path module - Better handles Windows absolute paths like 'C:\Users\...' and '\UNC\paths' - Preserves existing fs.access fallback behavior for external files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/core/PathUtils.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/PathUtils.ts b/src/core/PathUtils.ts index 3f46799..4d6b16b 100644 --- a/src/core/PathUtils.ts +++ b/src/core/PathUtils.ts @@ -105,8 +105,17 @@ export class PathUtils { } } - // For paths outside vault, use fs fallback (needed for external file processing) - if (path.includes('/') && !path.startsWith('.')) { + // 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 + + if (isLikelyAbsolutePath) { try { const fs = require('fs').promises; await fs.access(path);