From 84081cc3b5287f925ffeeb94ae730e4c143b5f59 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 26 Feb 2023 17:40:39 -0400 Subject: encode/decode URIs in html.tag('a') & live-dev-server Fixes #147. --- src/util/html.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/util/html.js') diff --git a/src/util/html.js b/src/util/html.js index a6b0d621..459a1647 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -130,6 +130,14 @@ export function attributes(attribs) { throw new Error(`Attribute value for ${key} should be primitive or array, got ${typeof val}`); }) .filter(([_key, _val, keep]) => keep) + .map(([key, val]) => { + switch (key) { + case 'href': + return [key, encodeURI(val)]; + default: + return [key, val]; + } + }) .map(([key, val]) => typeof val === 'boolean' ? `${key}` -- cgit 1.3.0-6-gf8a5