This commit is contained in:
Stiven Valeriano 2026-04-02 00:14:57 +07:00 committed by GitHub
commit 3f382ccd6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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
}