about summary refs log tree commit diff stats
path: root/src/config/mimetypes.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-08-13 19:29:15 +0200
committerbptato <nincsnevem662@gmail.com>2023-08-13 19:31:31 +0200
commitf50f41d7954aeb63510f23c0600b9eb23793cae8 (patch)
tree3158a902f1e0f2f1564c02cb7f55d7a968626d3c /src/config/mimetypes.nim
parent90b9019a4a3d057adc0cbc7ec984de76dc0ccf02 (diff)
downloadchawan-f50f41d7954aeb63510f23c0600b9eb23793cae8.tar.gz
Do not replace existing mime types
Make mime.types behavior consistent with mailcap: that is, the *first*
match counts.
Diffstat (limited to 'src/config/mimetypes.nim')
-rw-r--r--src/config/mimetypes.nim3
1 files changed, 2 insertions, 1 deletions
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 =