diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Keep line structure in plaintext readmes
Diffstat (limited to 'source')
-rw-r--r--source/ui-summary.c5
1 file changed, 4 insertions, 1 deletion
diff --git a/source/ui-summary.c b/source/ui-summary.c
index b5a6a22..8dd191b 100644
--- a/source/ui-summary.c
+++ b/source/ui-summary.c
@@ -167,8 +167,10 @@ void cgit_print_repo_readme(const char *path)
/* No about-filter is configured, so there is nothing to turn
* the readme source into safe HTML. Escape it rather than serve
* repo content raw, which would let an untrusted repository
- * inject script into the about page.
+ * inject script into the about page. The pre keeps the line
+ * structure of the text, which bare escaped output loses.
*/
+ html("<pre class='plaintext'>");
if (ref) {
cgit_print_file(filename, ref, 1, 1);
} else {
@@ -177,6 +179,7 @@ void cgit_print_repo_readme(const char *path)
html_txt(sb.buf);
strbuf_release(&sb);
}
+ html("</pre>");
} else {
/* An about-filter is configured and is responsible for turning
* the source into safe HTML, so pass it through the filter raw.