diff options
author | Moritz Poldrack <git@moritz.sh> | 2023-06-28 23:17:30 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-07-06 00:14:13 +0200 |
commit | 52203aba5876c0b98172d890dbe448894b8f1dd9 (patch) | |
tree | 99ef93600ca59b1795c3c18c92f8ddbdc17daa7e /lib | |
parent | 95b670a4de08e74506957b918d696894ca06d102 (diff) | |
download | aerc-52203aba5876c0b98172d890dbe448894b8f1dd9.tar.gz |
lib: invert logic of mimeDB lookup
This just looked weird.
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/attachment.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/attachment.go b/lib/attachment.go index 5c2284f5..f6118780 100644 --- a/lib/attachment.go +++ b/lib/attachment.go @@ -71,10 +71,8 @@ func (fa *FileAttachment) WriteTo(w *mail.Writer) error { // under the hood, e.g. most office file types ext := filepath.Ext(fa.path) var mimeString string - if mimeString = mime.TypeByExtension(ext); mimeString != "" { - // found it in the DB - } else { - // Sniff the mime type instead + if mimeString = mime.TypeByExtension(ext); mimeString == "" { + // Sniff the mime type since it's not in the database // http.DetectContentType only cares about the first 512 bytes head, err := reader.Peek(512) if err != nil && err != io.EOF { |