aboutsummaryrefslogtreecommitdiffstats
path: root/ui-summary.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-summary.c')
-rw-r--r--ui-summary.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ui-summary.c b/ui-summary.c
index abf914e..ffad4f2 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -98,6 +98,7 @@ void cgit_print_summary()
98void cgit_print_repo_readme(char *path) 98void cgit_print_repo_readme(char *path)
99{ 99{
100 char *slash, *tmp, *colon, *ref; 100 char *slash, *tmp, *colon, *ref;
101 int free_filename = 0;
101 102
102 if (!ctx.repo->readme || !(*ctx.repo->readme)) 103 if (!ctx.repo->readme || !(*ctx.repo->readme))
103 return; 104 return;
@@ -134,6 +135,7 @@ void cgit_print_repo_readme(char *path)
134 return; 135 return;
135 slash = colon; 136 slash = colon;
136 } 137 }
138 free_filename = 1;
137 tmp = xmalloc(slash - ctx.repo->readme + 1 + strlen(path) + 1); 139 tmp = xmalloc(slash - ctx.repo->readme + 1 + strlen(path) + 1);
138 strncpy(tmp, ctx.repo->readme, slash - ctx.repo->readme + 1); 140 strncpy(tmp, ctx.repo->readme, slash - ctx.repo->readme + 1);
139 strcpy(tmp + (slash - ctx.repo->readme + 1), path); 141 strcpy(tmp + (slash - ctx.repo->readme + 1), path);
@@ -144,13 +146,19 @@ void cgit_print_repo_readme(char *path)
144 * filesystem, while applying the about-filter. 146 * filesystem, while applying the about-filter.
145 */ 147 */
146 html("<div id='summary'>"); 148 html("<div id='summary'>");
147 if (ctx.repo->about_filter) 149 if (ctx.repo->about_filter) {
150 ctx.repo->about_filter->argv[1] = tmp;
148 cgit_open_filter(ctx.repo->about_filter); 151 cgit_open_filter(ctx.repo->about_filter);
152 }
149 if (ref) 153 if (ref)
150 cgit_print_file(tmp, ref); 154 cgit_print_file(tmp, ref);
151 else 155 else
152 html_include(tmp); 156 html_include(tmp);
153 if (ctx.repo->about_filter) 157 if (ctx.repo->about_filter) {
154 cgit_close_filter(ctx.repo->about_filter); 158 cgit_close_filter(ctx.repo->about_filter);
159 ctx.repo->about_filter->argv[1] = NULL;
160 }
155 html("</div>"); 161 html("</div>");
162 if (free_filename)
163 free(tmp);
156} 164}