diff options
author | John Keeping | 2015-08-14 12:47:04 +0100 |
---|---|---|
committer | Jason A. Donenfeld | 2015-08-14 15:46:51 +0200 |
commit | 2b3e76a9f95c50f55be70dbb1cfa029f5165a535 (patch) | |
tree | 797f8258f93660c8311626f064037267fa843110 | |
parent | clone: use cgit_print_error_page() instead of html_status() (diff) | |
download | cgit-2b3e76a9f95c50f55be70dbb1cfa029f5165a535.tar.gz cgit-2b3e76a9f95c50f55be70dbb1cfa029f5165a535.zip |
plain: use cgit_print_error_page() instead of html_status()
This provides a formatted error response rather than a simple HTTP error. Signed-off-by: John Keeping <john@keeping.me.uk>
-rw-r--r-- | ui-plain.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ui-plain.c b/ui-plain.c index 3a2cb47..0daa7bf 100644 --- a/ui-plain.c +++ b/ui-plain.c | |||
@@ -66,13 +66,13 @@ static int print_object(const unsigned char *sha1, const char *path) | |||
66 | 66 | ||
67 | type = sha1_object_info(sha1, &size); | 67 | type = sha1_object_info(sha1, &size); |
68 | if (type == OBJ_BAD) { | 68 | if (type == OBJ_BAD) { |
69 | html_status(404, "Not found", 0); | 69 | cgit_print_error_page(404, "Not found", "Not found"); |
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | buf = read_sha1_file(sha1, &type, &size); | 73 | buf = read_sha1_file(sha1, &type, &size); |
74 | if (!buf) { | 74 | if (!buf) { |
75 | html_status(404, "Not found", 0); | 75 | cgit_print_error_page(404, "Not found", "Not found"); |
76 | return 0; | 76 | return 0; |
77 | } | 77 | } |
78 | ctx.page.mimetype = NULL; | 78 | ctx.page.mimetype = NULL; |
@@ -225,12 +225,12 @@ void cgit_print_plain(void) | |||
225 | rev = ctx.qry.head; | 225 | rev = ctx.qry.head; |
226 | 226 | ||
227 | if (get_sha1(rev, sha1)) { | 227 | if (get_sha1(rev, sha1)) { |
228 | html_status(404, "Not found", 0); | 228 | cgit_print_error_page(404, "Not found", "Not found"); |
229 | return; | 229 | return; |
230 | } | 230 | } |
231 | commit = lookup_commit_reference(sha1); | 231 | commit = lookup_commit_reference(sha1); |
232 | if (!commit || parse_commit(commit)) { | 232 | if (!commit || parse_commit(commit)) { |
233 | html_status(404, "Not found", 0); | 233 | cgit_print_error_page(404, "Not found", "Not found"); |
234 | return; | 234 | return; |
235 | } | 235 | } |
236 | if (!path_items.match) { | 236 | if (!path_items.match) { |
@@ -243,7 +243,7 @@ void cgit_print_plain(void) | |||
243 | walk_tree_ctx.match_baselen = basedir_len(path_items.match); | 243 | walk_tree_ctx.match_baselen = basedir_len(path_items.match); |
244 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | 244 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); |
245 | if (!walk_tree_ctx.match) | 245 | if (!walk_tree_ctx.match) |
246 | html_status(404, "Not found", 0); | 246 | cgit_print_error_page(404, "Not found", "Not found"); |
247 | else if (walk_tree_ctx.match == 2) | 247 | else if (walk_tree_ctx.match == 2) |
248 | print_dir_tail(); | 248 | print_dir_tail(); |
249 | } | 249 | } |