Skip to content

The agent that grows with you

refactor(desktop): share isWindowsAbsolutePath with the attachment upload check

brooklyn!2a38b294da82
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts
index 131a94ab6f6..4d96abdf7a5 100644
--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/index.ts
@@ -12,6 +12,7 @@ import { pathLabel } from '@/lib/chat-runtime'
import { sanitizeComposerInput } from '@/lib/composer-input-sanitize'
import { triggerHaptic } from '@/lib/haptics'
import { setMutableRef } from '@/lib/mutable-ref'
+import { isWindowsAbsolutePath } from '@/lib/path-compare'
import { normalize } from '@/lib/text'
import { transcribeAudioClientDirect } from '@/lib/voice-client-direct'
import { clearClarifyRequest } from '@/store/clarify'
@@ -89,7 +90,6 @@ interface HandoffResult {
error?: string
}
-const WINDOWS_ABSOLUTE_PATH_RE = /^(?:[A-Za-z]:[\\/]|\\\\)/
const POSIX_ABSOLUTE_PATH_RE = /^\/(?!\/)/
// Terminal backends whose execution environment has its own filesystem
@@ -109,7 +109,7 @@ function attachmentPathNeedsUpload(path: string, backendCwd?: null | string, ter
return true
}
- return WINDOWS_ABSOLUTE_PATH_RE.test(path.trim()) && POSIX_ABSOLUTE_PATH_RE.test(backendCwd?.trim() || '')
+ return isWindowsAbsolutePath(path.trim()) && POSIX_ABSOLUTE_PATH_RE.test(backendCwd?.trim() || '')
}
/**