diff --git a/internal/shell/shell.go b/internal/shell/shell.go index e5a54f01c403ae1b8de681616c5d693bc842ac14..ced8da26ed4e837b08e66152e9aafb2cc029c0d1 100644 --- a/internal/shell/shell.go +++ b/internal/shell/shell.go @@ -227,7 +227,7 @@ func (s *Shell) blockHandler() func(next interp.ExecHandlerFunc) interp.ExecHand for _, blockFunc := range s.blockFuncs { if blockFunc(args) { - return fmt.Errorf("command is not allowed for security reasons: %s", strings.Join(args, " ")) + return fmt.Errorf("command is not allowed for security reasons: %q", args[0]) } } diff --git a/internal/tui/components/chat/editor/editor.go b/internal/tui/components/chat/editor/editor.go index 8f7c43c76a965539db3c3d6de4f46377c8a10a5c..ba832b415133305fccbefa37da6b749405feb2c6 100644 --- a/internal/tui/components/chat/editor/editor.go +++ b/internal/tui/components/chat/editor/editor.go @@ -39,6 +39,9 @@ var ( errClipboardUnknownFormat = fmt.Errorf("unknown clipboard format") ) +// If pasted text has more than 10 newlines, treat it as a file attachment. +const pasteLinesThreshold = 10 + type Editor interface { util.Model layout.Sizeable @@ -239,8 +242,7 @@ func (m *editorCmp) Update(msg tea.Msg) (util.Model, tea.Cmd) { m.textarea.SetValue(msg.Text) m.textarea.MoveToEnd() case tea.PasteMsg: - // If pasted text has more than 2 newlines, treat it as a file attachment. - if strings.Count(msg.Content, "\n") > 2 { + if strings.Count(msg.Content, "\n") > pasteLinesThreshold { content := []byte(msg.Content) if len(content) > maxAttachmentSize { return m, util.ReportWarn("Paste is too big (>5mb)")