about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-28 01:26:14 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-28 01:26:14 +0200
commitdbf52de5c226443a7e20789a414cb27a7bc6991f (patch)
tree6d3e87f10b14651e45138977a73412a7ee72cf54
parent3f919dda32231276c9388e1f1278d73465c14e3e (diff)
downloadchawan-dbf52de5c226443a7e20789a414cb27a7bc6991f.tar.gz
buffer: fix ampersand escaping in markURL
-rw-r--r--src/server/buffer.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server/buffer.nim b/src/server/buffer.nim
index cffe33b1..6b214b4e 100644
--- a/src/server/buffer.nim
+++ b/src/server/buffer.nim
@@ -1796,6 +1796,9 @@ proc markURL*(buffer: Buffer; schemes: seq[string]) {.proxy.} =
               of '"':
                 data &= "&quot;"
                 offset += 5
+              of '&':
+                data &= "&amp;"
+                offset += 4
               else:
                 data &= c
               inc j
@@ -1812,6 +1815,7 @@ proc markURL*(buffer: Buffer; schemes: seq[string]) {.proxy.} =
             of '>': data &= "&gt;"
             of '\'': data &= "&apos;"
             of '"': data &= "&quot;"
+            of '&': data &= "&amp;"
             else: data &= c
             inc j
           let replacement = html.fragmentParsingAlgorithm(data)