mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
Return result when found instead of keep iterating for no reason the whole mimedb on mimetypes module (#10675)
This commit is contained in:
committed by
Andreas Rumpf
parent
6d8ce609d7
commit
b3ffbac93c
@@ -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``.
|
||||
|
||||
Reference in New Issue
Block a user