fix(GODT-3151): Only modify HTML Meta content if UTF-8 charset override is needed.

This commit is contained in:
Romain LE JEUNE
2023-12-04 10:37:19 +01:00
parent a8f270405f
commit 9efaf9184c
4 changed files with 60 additions and 15 deletions

View File

@ -137,15 +137,15 @@ func (p *Part) ConvertMetaCharset() error {
if val, ok := sel.Attr("content"); ok {
t, params, err := pmmime.ParseMediaType(val)
if err != nil {
logrus.WithField("pkg", "parser").WithError(err).Error("Meta tag parsing fails.")
return
}
if charset, ok := params["charset"]; ok && charset != utf8Charset {
params["charset"] = utf8Charset
sel.SetAttr("content", mime.FormatMediaType(t, params))
metaModified = true
}
sel.SetAttr("content", mime.FormatMediaType(t, params))
metaModified = true
}
if charset, ok := sel.Attr("charset"); ok && charset != utf8Charset {