From 94ab6ade176274fe7f390a36b27f47ee8877be06 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 10:09:39 -1000 Subject: Check that link-trailers encodes a rule capture As in link-commits, every capture was hex or digits. A string replacement there would also raise outside the pcall that guards the pattern and take the whole page down. --- tests/extensions/test-link-trailers.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/extensions/test-link-trailers.lua') diff --git a/tests/extensions/test-link-trailers.lua b/tests/extensions/test-link-trailers.lua index 7aed9d2..9c3b264 100644 --- a/tests/extensions/test-link-trailers.lua +++ b/tests/extensions/test-link-trailers.lua @@ -71,4 +71,11 @@ out, ret = render("Fixes", "") h.equals("an empty value stays empty", out, "") h.equals("an empty value still answers zero", ret, 0) +-- A rule broad enough to capture a quote or a percent sign still has to +-- leave a url that stays inside its attribute and means what it says. +h.load_with(arg[1], { { "local rules = {", "local rules = { { key = \"Ref\", pattern = \"^(%S+)$\", url = \"https://t/%s\" }," } }) + +out = render("Ref", "a'b%c") +h.equals("a captured value is percent-encoded into the url", out, "a'b%c") + h.finish() -- cgit 2.12.1