From 7b7f0e3636112782a7915bb1afcc57a23c0b6092 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 17:56:55 -1000 Subject: Lead a readme's relative links into the tree A browser resolved them against the about page, where nothing lives now that the page answers 404 below itself. They resolve the way GitHub resolves a readme's links instead, from the readme's directory and on the branch it was read from. --- tests/extensions/harness.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/extensions/harness.lua') diff --git a/tests/extensions/harness.lua b/tests/extensions/harness.lua index d9318ee..fc83a73 100644 --- a/tests/extensions/harness.lua +++ b/tests/extensions/harness.lua @@ -46,16 +46,23 @@ html_attr = sink(function(s) return (s:gsub("[&<>'\"]", attr_map)) end) +-- The bytes url_escape_table encodes, which are those a url path cannot +-- carry plainly and those an attribute or a query would misread. +html_url_path = sink(function(s) + return (s:gsub("[%c \"#%%&'+<=>?\\^`{|}\128-\255]", function(c) + return string.format("%%%02X", c:byte()) + end)) +end) + -- No shipped extension calls the remaining sinks, so rather than risk an -- unfaithful copy quietly passing a test, using one fails loudly until its --- escaping is mirrored from source/html.c the way the three above are. +-- escaping is mirrored from source/html.c the way the ones above are. local function unmirrored(name) return function() error(name .. " is not mirrored by the test harness yet") end end -html_url_path = unmirrored("html_url_path") html_url_arg = unmirrored("html_url_arg") html_include = unmirrored("html_include") -- cgit