From 2fb0aa9c961318eb6be3130e2515ebc3f2e098c0 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Sat, 28 Feb 2026 01:38:01 +0200 Subject: [PATCH] fix: treat pasted absolute paths as normal messages --- packages/ui/src/stores/messageStore.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/ui/src/stores/messageStore.ts b/packages/ui/src/stores/messageStore.ts index 819b0de8..b7157da9 100644 --- a/packages/ui/src/stores/messageStore.ts +++ b/packages/ui/src/stores/messageStore.ts @@ -689,9 +689,21 @@ export const useMessageStore = create()( await executeWithSessionDirectory(sessionId, async () => { try { const trimmedContent = content.trimStart(); + const firstTokenLooksLikeAbsolutePath = (() => { + if (!trimmedContent.startsWith('/')) return false; + const firstWhitespaceIndex = trimmedContent.search(/\s/); + const firstToken = firstWhitespaceIndex === -1 + ? trimmedContent + : trimmedContent.slice(0, firstWhitespaceIndex); + if (firstToken.length <= 1) return false; + const tokenWithoutLeadingSlash = firstToken.slice(1); + if (!tokenWithoutLeadingSlash.includes('/')) return false; + return true; + })(); const commandPayload = (() => { if (inputMode === 'shell') return null; if (!trimmedContent.startsWith("/")) return null; + if (firstTokenLooksLikeAbsolutePath) return null; const firstLineEnd = trimmedContent.indexOf("\n"); const firstLine = firstLineEnd === -1 ? trimmedContent : trimmedContent.slice(0, firstLineEnd); const [commandToken, ...firstLineArgs] = firstLine.split(" "); @@ -716,6 +728,7 @@ export const useMessageStore = create()( })(); const slashShellPayload = (() => { if (!trimmedContent.startsWith("/")) return null; + if (firstTokenLooksLikeAbsolutePath) return null; const firstLineEnd = trimmedContent.indexOf("\n"); const firstLine = firstLineEnd === -1 ? trimmedContent : trimmedContent.slice(0, firstLineEnd); const [commandToken, ...firstLineArgs] = firstLine.split(" ");