about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-07-10 16:41:06 +0200
committerbptato <nincsnevem662@gmail.com>2024-07-10 16:41:49 +0200
commit37c144fea89bf02a449666128ac2ca8f85f2a985 (patch)
treee513e5da0ccf740ab7d393bc233e8a0da6f4aa5e /src
parent997659102f16a5afc90585651e8c8502e0c8f45e (diff)
downloadchawan-37c144fea89bf02a449666128ac2ca8f85f2a985.tar.gz
fix compilation on 2.0.8
Diffstat (limited to 'src')
-rw-r--r--src/config/mimetypes.nim11
-rw-r--r--src/utils/mimeguess.nim1
2 files changed, 9 insertions, 3 deletions
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.
diff --git a/src/utils/mimeguess.nim b/src/utils/mimeguess.nim
index 5bbabcc1..f13eaf89 100644
--- a/src/utils/mimeguess.nim
+++ b/src/utils/mimeguess.nim
@@ -1,5 +1,6 @@
 import std/algorithm
 import std/streams
+import std/tables
 
 import config/mimetypes