From 97ec09e1cc941fe04e6faf3380b3ccf9d67054c4 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 15 Jul 2026 19:57:16 -1000 Subject: Harden the blob view error paths A blob requested by ref with an unknown path fell through to the commit object and was served with a 200 instead of a 404. Two error pages passed a null pointer to a %s format when the request carried no object id, and the error pages left the layout open. --- source/ui-plain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/ui-plain.c') diff --git a/source/ui-plain.c b/source/ui-plain.c index a2a4087..c041711 100644 --- a/source/ui-plain.c +++ b/source/ui-plain.c @@ -27,13 +27,13 @@ static int print_object(const struct object_id *oid, const char *path) type = odb_read_object_info(the_repository->objects, oid, &size); if (type == OBJ_BAD) { cgit_print_error_page(404, "Not found", "Not found"); - return 0; + return 1; } buf = odb_read_object(the_repository->objects, oid, &type, &size); if (!buf) { cgit_print_error_page(404, "Not found", "Not found"); - return 0; + return 1; } mimetype = get_mimetype_for_filename(path); -- cgit 2.12.1