diff options
author | Ben Cohen <ben@bencohen.net> | 2019-08-01 16:19:57 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-08-03 10:47:58 -0400 |
commit | 302bc1cda6a5f138a033b5d970ccee2d0abc0334 (patch) | |
tree | 51f562a1cbb7e43f8ee1f99c77ea6b423ef3df3d /widgets | |
parent | f4b774146387f147d6e693d789889bfdd817a290 (diff) | |
download | aerc-302bc1cda6a5f138a033b5d970ccee2d0abc0334.tar.gz |
Fixing #231 (alternative preferred mimetypes)
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/msgviewer.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 5b97f6f..e210616 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -168,16 +168,16 @@ func createSwitcher(switcher *PartSwitcher, conf *config.AercConfig, if switcher.selected == -1 && pv.part.MIMEType != "multipart" { switcher.selected = i } - if selectedPriority == -1 { - for idx, m := range conf.Viewer.Alternatives { - if m != pv.part.MIMEType+"/"+pv.part.MIMESubType { - continue - } - priority := len(conf.Viewer.Alternatives) - idx - if priority > selectedPriority { - selectedPriority = priority - switcher.selected = i - } + mime := strings.ToLower(pv.part.MIMEType) + + "/" + strings.ToLower(pv.part.MIMESubType) + for idx, m := range conf.Viewer.Alternatives { + if m != mime { + continue + } + priority := len(conf.Viewer.Alternatives) - idx + if priority > selectedPriority { + selectedPriority = priority + switcher.selected = i } } } |