diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Hand the about filter the tree url its links need
With nothing below the about page, a readme's relative links have to be
written against the tree, and only cgit knows how this site spells the
url of a tree page and which ref the readme was read from. Both reach
the filter already escaped for a url, built by the same writer as
cgit's own links.
Diffstat (limited to 'source/ui-summary.c')
| -rw-r--r-- | source/ui-summary.c | 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 9 insertions, 1 deletion
diff --git a/source/ui-summary.c b/source/ui-summary.c index e7b229a..44abc6b 100644 --- a/source/ui-summary.c +++ b/source/ui-summary.c @@ -91,14 +91,22 @@ void cgit_print_repo_readme(void) } html("</pre>"); } else { + struct strbuf tree_base = STRBUF_INIT, tree_query = STRBUF_INIT; + + // A tracked readme's links lead into the tree at the ref it was + // read from, while one on disk has no tree to lead into. + if (ref) + cgit_tree_url(ref, &tree_base, &tree_query); // The filter is what makes the source safe here, so it is fed // through unescaped. - cgit_open_filter(ctx.repo->about_filter, filename); + cgit_open_filter(ctx.repo->about_filter, filename, tree_base.buf, tree_query.buf); if (ref) cgit_print_file(filename, ref, 1, 0); else html_include(filename); cgit_close_filter(ctx.repo->about_filter); + strbuf_release(&tree_base); + strbuf_release(&tree_query); } html("</div>"); cgit_print_layout_end(); |
