]> git.cameronkatri.com Git - cgit.git/commitdiff
return 404 if snapshot is not found
authorNatanael Copa <natanael.copa@gmail.com>
Tue, 2 Dec 2008 10:31:34 +0000 (11:31 +0100)
committerLars Hjemli <hjemli@gmail.com>
Sun, 28 Dec 2008 09:09:18 +0000 (10:09 +0100)
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
ui-snapshot.c

index 6f09151d8b68e9d1ebee1d2708c73cc7e28fc206..f98f5d74bf46ead3077bd79a975703d9bb016c83 100644 (file)
@@ -175,10 +175,12 @@ 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) {
-                       prefix = xstrdup(filename);
-                       prefix[strlen(filename) - strlen(f->suffix)] = '\0';
+               if (hex == NULL) {
+                       html_status(404, "Not found", 0);
+                       return;
                }
+               prefix = xstrdup(filename);
+               prefix[strlen(filename) - strlen(f->suffix)] = '\0';
        }
 
        if (!hex)