File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -82,11 +82,12 @@ func TruncateHTMLResponse(body string) string {
8282 trimmed := strings .TrimSpace (body )
8383 normalized := strings .ToLower (trimmed )
8484 if strings .HasPrefix (normalized , "<!doctype" ) || strings .HasPrefix (normalized , "<html" ) {
85- // Extract title if present
86- if idx := strings .Index (body , "<title>" ); idx != - 1 {
87- endIdx := strings .Index (body [idx :], "</title>" )
85+ // Extract title if present (case-insensitive on tag name)
86+ lowerBody := strings .ToLower (body )
87+ if idx := strings .Index (lowerBody , "<title>" ); idx != - 1 {
88+ endIdx := strings .Index (lowerBody [idx :], "</title>" )
8889 if endIdx != - 1 {
89- title := body [idx + 7 : idx + endIdx ]
90+ title := body [idx + len ( "<title>" ) : idx + endIdx ]
9091 return fmt .Sprintf ("Server says: %s" , title )
9192 }
9293 }
You can’t perform that action at this time.
0 commit comments