소스 검색

fix: tui attachment bound (#2361)

Aiden Cline 7 달 전
부모
커밋
26f75d4e68
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      packages/tui/internal/app/prompt.go

+ 3 - 0
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:]
 		}
 	}