Fixing #231 (alternative preferred mimetypes)

This commit is contained in:
Ben Cohen 2019-08-01 16:19:57 -04:00 committed by Drew DeVault
parent f4b7741463
commit 302bc1cda6
1 changed files with 10 additions and 10 deletions

View File

@ -168,9 +168,10 @@ func createSwitcher(switcher *PartSwitcher, conf *config.AercConfig,
if switcher.selected == -1 && pv.part.MIMEType != "multipart" { if switcher.selected == -1 && pv.part.MIMEType != "multipart" {
switcher.selected = i switcher.selected = i
} }
if selectedPriority == -1 { mime := strings.ToLower(pv.part.MIMEType) +
"/" + strings.ToLower(pv.part.MIMESubType)
for idx, m := range conf.Viewer.Alternatives { for idx, m := range conf.Viewer.Alternatives {
if m != pv.part.MIMEType+"/"+pv.part.MIMESubType { if m != mime {
continue continue
} }
priority := len(conf.Viewer.Alternatives) - idx priority := len(conf.Viewer.Alternatives) - idx
@ -181,7 +182,6 @@ func createSwitcher(switcher *PartSwitcher, conf *config.AercConfig,
} }
} }
} }
}
return nil return nil
} }