Skip to content

Commit c6ecbcc

Browse files
Update internal/portal/portal.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent ef86d30 commit c6ecbcc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

internal/portal/portal.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)