about summary refs log tree commit diff stats
path: root/src/html/dom.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/html/dom.nim')
-rw-r--r--src/html/dom.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index e58be7fc..20f21264 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -3035,12 +3035,15 @@ proc loadResource(window: Window; image: HTMLImageElement) =
           return newResolvedPromise()
         let response = res.get
         let contentType = response.getContentType("image/x-unknown")
-        if contentType.until('/') != "image":
+        if not contentType.startsWith("image/"):
           return newResolvedPromise()
         let cacheId = window.loader.addCacheFile(response.outputId,
           window.loader.clientPid)
+        let url = newURL("img-codec+" & contentType.after('/') & ":decode")
+        if url.isNone:
+          return newResolvedPromise()
         let request = newRequest(
-          newURL("img-codec+" & contentType.after('/') & ":decode").get,
+          url.get,
           httpMethod = hmPost,
           headers = newHeaders({"Cha-Image-Info-Only": "1"}),
           body = RequestBody(t: rbtOutput, outputId: response.outputId),