aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2023-06-28 23:17:30 +0200
committerRobin Jarry <robin@jarry.cc>2023-07-06 00:14:13 +0200
commit52203aba5876c0b98172d890dbe448894b8f1dd9 (patch)
tree99ef93600ca59b1795c3c18c92f8ddbdc17daa7e
parent95b670a4de08e74506957b918d696894ca06d102 (diff)
downloadaerc-52203aba5876c0b98172d890dbe448894b8f1dd9.tar.gz
aerc-52203aba5876c0b98172d890dbe448894b8f1dd9.zip
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>
-rw-r--r--lib/attachment.go6
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 {