Return result when found instead of keep iterating for no reason the whole mimedb on mimetypes module (#10675)

This commit is contained in:
Juan Carlos
2019-02-15 04:42:13 -03:00
committed by Andreas Rumpf
parent 6d8ce609d7
commit b3ffbac93c

View File

@@ -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``.