fix limit html meta response body size

This commit is contained in:
Stiven Valeriano 2026-03-24 17:28:28 -05:00
parent 2327f4e3a6
commit 3f9b5f2c8f
1 changed files with 2 additions and 3 deletions

View File

@ -51,9 +51,8 @@ func GetHTMLMeta(urlStr string) (*HTMLMeta, error) {
return nil, errors.New("not a HTML page")
}
// TODO: limit the size of the response body
htmlMeta := extractHTMLMeta(response.Body)
reader := io.LimitReader(response.Body, 1<<20) // 1 MB max
htmlMeta := extractHTMLMeta(reader)
enrichSiteMeta(response.Request.URL, htmlMeta)
return htmlMeta, nil
}