summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-09-01 16:33:36 -0500
committerGitHub <[email protected]>2025-09-01 16:33:36 -0500
commit26f75d4e68a98ff28eac792b4ee7189b28c03b45 (patch)
tree62cb92ce95505494f89cb0a04ea4273c6e04fadf
parent8ba8d3c7e31f7442944529e16767efe1ab6a456e (diff)
downloadopencode-26f75d4e68a98ff28eac792b4ee7189b28c03b45.tar.gz
opencode-26f75d4e68a98ff28eac792b4ee7189b28c03b45.zip
fix: tui attachment bound (#2361)
-rw-r--r--packages/tui/internal/app/prompt.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/tui/internal/app/prompt.go b/packages/tui/internal/app/prompt.go
index 8701a2072..bd5086a45 100644
--- a/packages/tui/internal/app/prompt.go
+++ b/packages/tui/internal/app/prompt.go
@@ -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:]
}
}