about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ui-blob.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ui-blob.c b/ui-blob.c index 388a017..b333f86 100644 --- a/ui-blob.c +++ b/ui-blob.c
@@ -126,12 +126,14 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
126 126
127 if (hex) { 127 if (hex) {
128 if (get_sha1_hex(hex, sha1)) { 128 if (get_sha1_hex(hex, sha1)) {
129 cgit_print_error("Bad hex value: %s", hex); 129 cgit_print_error_page(400, "Bad request",
130 "Bad hex value: %s", hex);
130 return; 131 return;
131 } 132 }
132 } else { 133 } else {
133 if (get_sha1(head, sha1)) { 134 if (get_sha1(head, sha1)) {
134 cgit_print_error("Bad ref: %s", head); 135 cgit_print_error_page(404, "Not found",
136 "Bad ref: %s", head);
135 return; 137 return;
136 } 138 }
137 } 139 }
@@ -145,13 +147,15 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
145 } 147 }
146 148
147 if (type == OBJ_BAD) { 149 if (type == OBJ_BAD) {
148 cgit_print_error("Bad object name: %s", hex); 150 cgit_print_error_page(404, "Not found",
151 "Bad object name: %s", hex);
149 return; 152 return;
150 } 153 }
151 154
152 buf = read_sha1_file(sha1, &type, &size); 155 buf = read_sha1_file(sha1, &type, &size);
153 if (!buf) { 156 if (!buf) {
154 cgit_print_error("Error reading object %s", hex); 157 cgit_print_error_page(500, "Internal server error",
158 "Error reading object %s", hex);
155 return; 159 return;
156 } 160 }
157 161