From 37c144fea89bf02a449666128ac2ca8f85f2a985 Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 10 Jul 2024 16:41:06 +0200 Subject: fix compilation on 2.0.8 --- src/config/mimetypes.nim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/config/mimetypes.nim') diff --git a/src/config/mimetypes.nim b/src/config/mimetypes.nim index f247822e..9beb42c7 100644 --- a/src/config/mimetypes.nim +++ b/src/config/mimetypes.nim @@ -6,9 +6,14 @@ import utils/twtstr # extension -> type type MimeTypes* = distinct Table[string, string] -proc `[]`*(mimeTypes: MimeTypes; k: string): string {.borrow.} -proc contains*(mimeTypes: MimeTypes; k: string): bool {.borrow.} -proc hasKeyOrPut*(mimeTypes: var MimeTypes; k, v: string): bool {.borrow.} +template `[]`*(mimeTypes: MimeTypes; k: string): string = + Table[string, string](mimeTypes)[k] + +template contains*(mimeTypes: MimeTypes; k: string): bool = + k in Table[string, string](mimeTypes) + +template hasKeyOrPut*(mimeTypes: var MimeTypes; k, v: string): bool = + Table[string, string](mimeTypes).hasKeyOrPut(k, v) # Add mime types found in stream to mimeTypes. # No error handling for now. -- cgit 1.4.1-2-gfad0