Return result when found instead of keep iterating for no reason the whole mimedb on mimetypes module (#10675)
This commit is contained in:
parent
6d8ce609d7
commit
b3ffbac93c
1 changed files with 1 additions and 0 deletions
|
|
@ -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``.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue