on main help sign in
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.

commitc770a8a2ac38c53759342a42d37740c93c581314 authorAyman Bagabas <ayman.bagabas@gmail.com> dateThu 7 Aug 2025, 10:10 (1 year ago) parent152630f
1 file changed+1−1
internal/tui/components/chat/editor/editor.go+1−1
internal/tui/components/chat/editor/editor.go+1−1
@@ -228,7 +228,7 @@ func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
228228 case tea.PasteMsg:
229229 path := strings.ReplaceAll(string(msg), "\\ ", " ")
230230 // try to get an image
231− path, err := filepath.Abs(path)
231+ path, err := filepath.Abs(strings.TrimSpace(path))
232232 if err != nil {
233233 m.textarea, cmd = m.textarea.Update(msg)
234234 return m, cmd