forked from Silverfish/proton-bridge
fix: always check charset before utf8 validity
This commit is contained in:
@ -65,10 +65,6 @@ func (p *Part) AddChild(child *Part) {
|
||||
}
|
||||
|
||||
func (p *Part) ConvertToUTF8() error {
|
||||
if utf8.Valid(p.Body) {
|
||||
return nil
|
||||
}
|
||||
|
||||
t, params, err := p.Header.ContentType()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -99,6 +95,10 @@ func selectSuitableDecoder(p *Part, t string, params map[string]string) *encodin
|
||||
}
|
||||
}
|
||||
|
||||
if utf8.Valid(p.Body) {
|
||||
return encoding.Nop.NewDecoder()
|
||||
}
|
||||
|
||||
encoding, _, _ := charset.DetermineEncoding(p.Body, t)
|
||||
|
||||
return encoding.NewDecoder()
|
||||
|
||||
Reference in New Issue
Block a user