From f50f41d7954aeb63510f23c0600b9eb23793cae8 Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 13 Aug 2023 19:29:15 +0200 Subject: Do not replace existing mime types Make mime.types behavior consistent with mailcap: that is, the *first* match counts. --- src/config/mimetypes.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/config/mimetypes.nim') diff --git a/src/config/mimetypes.nim b/src/config/mimetypes.nim index 2b0900d5..2c2bcc50 100644 --- a/src/config/mimetypes.nim +++ b/src/config/mimetypes.nim @@ -29,7 +29,8 @@ proc parseMimeTypes*(mimeTypes: var MimeTypes, stream: Stream) = ext &= line[i].tolower() inc i if ext == "": continue - mimeTypes[ext] = t + if ext notin mimeTypes: + mimeTypes[ext] = t stream.close() proc parseMimeTypes*(stream: Stream): MimeTypes = -- cgit 1.4.1-2-gfad0