summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJuan Carlos <juancarlospaco@gmail.com>2019-02-15 04:42:13 -0300
committerAndreas Rumpf <rumpf_a@web.de>2019-02-15 08:42:13 +0100
commitb3ffbac93c1485ca9b7fd5f5d7ddd3fb9461d8e4 (patch)
treed69b867e02b2768d149f079fcbbe0b6665f9e66b
parent6d8ce609d7a5c2b24a2dc86db85a798436223ee6 (diff)
downloadNim-b3ffbac93c1485ca9b7fd5f5d7ddd3fb9461d8e4.tar.gz
Return result when found instead of keep iterating for no reason the whole mimedb on mimetypes module (#10675)
-rw-r--r--lib/pure/mimetypes.nim1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/pure/mimetypes.nim b/lib/pure/mimetypes.nim
index 57ea82527..97ebd35c2 100644
--- a/lib/pure/mimetypes.nim
+++ b/lib/pure/mimetypes.nim
@@ -1906,6 +1906,7 @@ func getExt*(mimedb: MimeDB, mimetype: string, default = "txt"): string =
   for e, m in mimedb.mimes:
     if m == mimeLowered:
       result = e
+      break
 
 func register*(mimedb: var MimeDB, ext: string, mimetype: string) =
   ## Adds ``mimetype`` to the ``mimedb``.