]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-snapshot.c
snapshot: use cgit_print_error_page() for HTTP status codes
[ps-cgit] / ui-snapshot.c
index cb34f4b59c84cc61aeef210095bec9118537524a..9bcf13d2b835d8c4536a2986b17f5a622d725418 100644 (file)
@@ -112,11 +112,13 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
        unsigned char sha1[20];
 
        if (get_sha1(hex, sha1)) {
-               cgit_print_error("Bad object id: %s", hex);
+               cgit_print_error_page(404, "Not found",
+                               "Bad object id: %s", hex);
                return 1;
        }
        if (!lookup_commit_reference(sha1)) {
-               cgit_print_error("Not a commit reference: %s", hex);
+               cgit_print_error_page(400, "Bad request",
+                               "Not a commit reference: %s", hex);
                return 1;
        }
        ctx.page.etag = sha1_to_hex(sha1);
@@ -213,7 +215,7 @@ void cgit_print_snapshot(const char *head, const char *hex,
        if (!hex && dwim) {
                hex = get_ref_from_filename(ctx.repo->url, filename, f);
                if (hex == NULL) {
-                       html_status(404, "Not found", 0);
+                       cgit_print_error_page(404, "Not found", "Not found");
                        return;
                }
                prefix = xstrdup(filename);