From 17105dc54db3f6e28ce8e987eb0d870304669bb9 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 12 Nov 2026 17:51:42 +0000 Subject: cgit-about-filter: keep fragments out of the path --- pkgs/simple/cgit-about-filter/cgit-about-filter.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pkgs/simple/cgit-about-filter/cgit-about-filter.lua') diff --git a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua index 1b37643..64e16fa 100644 --- a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua +++ b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua @@ -73,12 +73,15 @@ function filter_close() return string.format("[%s](%s)", text, path) end + local fragment + path, fragment = path:match("^([^#]*)(.*)$") + path = resolve(current_dir, path) if path:sub(-3) == ".md" then - return string.format("[%s](/%s/about/%s)", text, repo, path) + return string.format("[%s](/%s/about/%s%s)", text, repo, path, fragment) else - return string.format("[%s](/%s/tree/%s)", text, repo, path) + return string.format("[%s](/%s/tree/%s%s)", text, repo, path, fragment) end end) -- cgit v1.3.1