From a22946abe7ce8d77e113056bc6833d72d3f143dd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 5 Feb 2010 20:08:41 +0000 Subject: [PATCH] * When a store path has disappeared for some reason, ../nix/ should return a HTTP error. Otherwise, mirror-channel.pl will happily mirror the error page. --- src/lib/Hydra/Base/Controller/ListBuilds.pm | 2 +- src/lib/Hydra/Base/Controller/NixChannel.pm | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Base/Controller/ListBuilds.pm b/src/lib/Hydra/Base/Controller/ListBuilds.pm index 2845ee23..85f1e509 100644 --- a/src/lib/Hydra/Base/Controller/ListBuilds.pm +++ b/src/lib/Hydra/Base/Controller/ListBuilds.pm @@ -83,7 +83,7 @@ sub nix : Chained('get_builds') PathPart('channel') CaptureArgs(1) { getChannelData($c, scalar($c->stash->{allBuilds})); } else { - error($c, "Unknown channel `$channelName'."); + notFound($c, "Unknown channel `$channelName'."); } }; error($c, $@) if $@; diff --git a/src/lib/Hydra/Base/Controller/NixChannel.pm b/src/lib/Hydra/Base/Controller/NixChannel.pm index d2755128..d3b2bb77 100644 --- a/src/lib/Hydra/Base/Controller/NixChannel.pm +++ b/src/lib/Hydra/Base/Controller/NixChannel.pm @@ -30,7 +30,10 @@ sub nar : Chained('nix') PathPart { my $path .= "/" . join("/", @rest); - error($c, "Path " . $path . " is no longer available.") unless isValidPath($path); + if (!isValidPath($path)) { + $c->response->status(410); "Gone" + error($c, "Path " . $path . " is no longer available."); + } # !!! check that $path is in the closure of $c->stash->{storePaths}.