From c770a8a2ac38c53759342a42d37740c93c581314 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 7 Aug 2025 10:10:53 -0400 Subject: [PATCH] fix(tui): editor: sanitize pasted paths Some terminals may add a trailing space to pasted paths preventing the editor from recognizing them as valid file paths. This commit ensures that pasted paths are trimmed of leading and trailing spaces for paths. --- internal/tui/components/chat/editor/editor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/tui/components/chat/editor/editor.go b/internal/tui/components/chat/editor/editor.go index 4c7df84daad5b911be66dcd7f7cf6d832d714293..37327ae86243e3cd211c822da10a07133916d318 100644 --- a/internal/tui/components/chat/editor/editor.go +++ b/internal/tui/components/chat/editor/editor.go @@ -228,7 +228,7 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case tea.PasteMsg: path := strings.ReplaceAll(string(msg), "\\ ", " ") // try to get an image - path, err := filepath.Abs(path) + path, err := filepath.Abs(strings.TrimSpace(path)) if err != nil { m.textarea, cmd = m.textarea.Update(msg) return m, cmd