about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJason A. Donenfeld2016-01-14 14:31:53 +0100
committerJason A. Donenfeld2016-01-14 14:31:53 +0100
commit92996ac2a6fc4e944c3d723e12d5ab244a43508e (patch)
treeee7f420c6612fdc0dd64031631ed53b8ce626c2e
parentui-blob: Do not accept mimetype from user (diff)
downloadcgit-92996ac2a6fc4e944c3d723e12d5ab244a43508e.tar.gz
cgit-92996ac2a6fc4e944c3d723e12d5ab244a43508e.zip
ui-blob: always use generic mimetypes
-rw-r--r--ui-blob.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/ui-blob.c b/ui-blob.c index 2cce11c..43a2f10 100644 --- a/ui-blob.c +++ b/ui-blob.c
@@ -161,12 +161,10 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
161 } 161 }
162 162
163 buf[size] = '\0'; 163 buf[size] = '\0';
164 if (!ctx.page.mimetype) { 164 if (buffer_is_binary(buf, size))
165 if (buffer_is_binary(buf, size)) 165 ctx.page.mimetype = "application/octet-stream";
166 ctx.page.mimetype = "application/octet-stream"; 166 else
167 else 167 ctx.page.mimetype = "text/plain";
168 ctx.page.mimetype = "text/plain";
169 }
170 ctx.page.filename = path; 168 ctx.page.filename = path;
171 cgit_print_http_headers(); 169 cgit_print_http_headers();
172 html_raw(buf, size); 170 html_raw(buf, size);