aboutsummaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorBen Cohen <ben@bencohen.net>2019-08-01 16:19:57 -0400
committerDrew DeVault <sir@cmpwn.com>2019-08-03 10:47:58 -0400
commit302bc1cda6a5f138a033b5d970ccee2d0abc0334 (patch)
tree51f562a1cbb7e43f8ee1f99c77ea6b423ef3df3d /widgets
parentf4b774146387f147d6e693d789889bfdd817a290 (diff)
Fixing #231 (alternative preferred mimetypes)
Diffstat (limited to 'widgets')
-rw-r--r--widgets/msgviewer.go20
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
}
}
}