fix: tui attachment bound (#2361)

This commit is contained in:
Aiden Cline 2025-09-01 16:33:36 -05:00 committed by GitHub
parent 8ba8d3c7e3
commit 26f75d4e68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,6 +43,9 @@ func (p Prompt) ToMessage(
}
for _, att := range textAttachments {
if source, ok := att.GetTextSource(); ok {
if att.StartIndex > att.EndIndex || att.EndIndex > len(text) {
continue
}
text = text[:att.StartIndex] + source.Value + text[att.EndIndex:]
}
}