|
diff --git a/ui-blob.c b/ui-blob.c index be4fb88..bd44574 100644 --- a/ ui-blob.c+++ b/ ui-blob.c |
|
@@ -14,27 +14,29 @@ void cgit_print_blob(struct cacheitem *item, const char *hex, char *path) |
14 | |
14 | |
15 | unsigned char sha1[20]; |
15 | unsigned char sha1[20]; |
16 | enum object_type type; |
16 | enum object_type type; |
17 | unsigned char *buf; |
17 | unsigned char *buf; |
18 | unsigned long size; |
18 | unsigned long size; |
19 | |
19 | |
20 | if (get_sha1_hex(hex, sha1)){ |
20 | if (get_sha1_hex(hex, sha1)){ |
21 | cgit_print_error(fmt("Bad hex value: %s", hex)); |
21 | cgit_print_error(fmt("Bad hex value: %s", hex)); |
22 | return; |
22 | return; |
23 | } |
23 | } |
24 | |
24 | |
25 | type = sha1_object_info(sha1, &size); |
25 | type = sha1_object_info(sha1, &size); |
26 | if (type == OBJ_BAD) { |
26 | if (type == OBJ_BAD) { |
27 | cgit_print_error(fmt("Bad object name: %s", hex)); |
27 | cgit_print_error(fmt("Bad object name: %s", hex)); |
28 | return; |
28 | return; |
29 | } |
29 | } |
30 | |
30 | |
31 | buf = read_sha1_file(sha1, &type, &size); |
31 | buf = read_sha1_file(sha1, &type, &size); |
32 | if (!buf) { |
32 | if (!buf) { |
33 | cgit_print_error(fmt("Error reading object %s", hex)); |
33 | cgit_print_error(fmt("Error reading object %s", hex)); |
34 | return; |
34 | return; |
35 | } |
35 | } |
36 | |
36 | |
37 | buf[size] = '\0'; |
37 | buf[size] = '\0'; |
38 | cgit_print_snapshot_start("text/plain", path, item); |
38 | ctx.page.mimetype = "text/plain"; |
| |
39 | ctx.page.filename = path; |
| |
40 | cgit_print_http_headers(&ctx); |
39 | write(htmlfd, buf, size); |
41 | write(htmlfd, buf, size); |
40 | } |
42 | } |
|