Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
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.
Diffstat (limited to 'tests/extensions/test-link-trailers.lua')
| -rw-r--r-- | tests/extensions/test-link-trailers.lua | 7 |
1 file changed, 7 insertions, 0 deletions
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 href='https://t/a%27b%25c'>a'b%c</a>") + h.finish() |
