blob: 8c6b88df067da7516a6344226f1f39a856c78489 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package config
import (
"fmt"
"strings"
"git.sr.ht/~rjarry/aerc/log"
"github.com/go-ini/ini"
)
func (config *AercConfig) parseConverters(file *ini.File) error {
converters, err := file.GetSection("multipart-converters")
if err != nil {
goto out
}
for mimeType, command := range converters.KeysHash() {
mimeType = strings.ToLower(mimeType)
if mimeType == "text/plain" {
return fmt.Errorf(
"multipart-converters: text/plain is reserved")
}
if !strings.HasPrefix(mimeType, "text/") {
return fmt.Errorf(
"multipart-converters: %q: only text/* MIME types are supported",
mimeType)
}
config.Converters[mimeType] = command
}
out:
log.Debugf("aerc.conf: [multipart-converters] %#v", config.Converters)
return nil
}
|