about summary refs log tree commit diff stats
path: root/src/io/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-01-25 18:33:59 +0100
committerbptato <nincsnevem662@gmail.com>2022-01-25 18:33:59 +0100
commit51d09498f2377804b65c167b49a5efb2703abe89 (patch)
treec06aac7b1fa248d72b12c48ff689be99e4cd6d32 /src/io/buffer.nim
parentdfe56d32a0664026db3f2c3d8e018670daaf66c1 (diff)
downloadchawan-51d09498f2377804b65c167b49a5efb2703abe89.tar.gz
Disallow different scheme in link tags
Diffstat (limited to 'src/io/buffer.nim')
-rw-r--r--src/io/buffer.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim
index 4020c2f2..370e8209 100644
--- a/src/io/buffer.nim
+++ b/src/io/buffer.nim
@@ -720,10 +720,11 @@ proc loadResources(buffer: Buffer, document: Document) =
       if elem.rel == "stylesheet":
         let url = parseUrl(elem.href, document.location.some)
         if url.issome:
-          let res = buffer.loader.getPage(url.get)
-          if res.s != nil and res.contenttype == "text/css":
-            let sheet = parseStylesheet(res.s.readAll())
-            elem.parentElement.sheets.add(sheet)
+          if url.get.scheme == buffer.location.scheme:
+            let res = buffer.loader.getPage(url.get)
+            if res.s != nil and res.contenttype == "text/css":
+              let sheet = parseStylesheet(res.s.readAll())
+              elem.parentElement.sheets.add(sheet)
 
     for i in countdown(elem.children.high, 0):
       let child = elem.children[i]