From 37079696b0d73e55f51d2de7dca7c1ff19273d3c Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 29 Oct 2026 14:37:25 -1000 Subject: Keep a readme whole past a NUL byte cgit takes filter output through a C string sink that stops at the first NUL, so a readme holding one lost everything after it. Each NUL now shows as U+FFFD, as a browser would show it. --- tests/extensions/test-about-render.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'tests/extensions/test-about-render.lua') diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua index e0fde6f..a493720 100644 --- a/tests/extensions/test-about-render.lua +++ b/tests/extensions/test-about-render.lua @@ -48,12 +48,11 @@ out = render(nil, "no name at all") h.contains("a missing filename renders as plain text", out, "
no name at all
") --- cgit's C sink stops at the first NUL byte, which the script documents, so --- the text past one is lost while the wrapper written separately survives. -out = render("README", "before\0after") -h.contains("text before a nul byte survives", out, "before") -h.excludes("text after a nul byte is dropped", out, "after") -h.contains("the wrapper written after the text survives", out, "") +-- cgit's C sink stops at the first NUL byte, so the script replaces each one +-- before anything is written, and the text past it survives. +out = render("README", "before\0after\0") +h.contains("a nul byte shows as a replacement character", out, + "
before\239\191\189after\239\191\189
") out = h.run({ "README" }, { "two ", "writes" }) h.contains("writes are joined before rendering", out, "two writes") -- cgit