From d1b50598c6ba7f0ca61bb0ea5e4ff9c66c226b4e Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 19 Jul 2026 15:47:52 -1000 Subject: Keep line structure in plaintext readmes --- source/ui-summary.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/ui-summary.c') 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("
");
 		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("
"); } else { /* An about-filter is configured and is responsible for turning * the source into safe HTML, so pass it through the filter raw. -- cgit v2.8.0