Return 410 Gone (rather than 500) if an output is no longer available
This commit is contained in:
@ -242,7 +242,7 @@ sub output : Chained('buildChain') PathPart Args(1) {
|
||||
error($c, "This build is not finished yet.") unless $build->finished;
|
||||
my $output = $build->buildoutputs->find({name => $outputName});
|
||||
notFound($c, "This build has no output named ‘$outputName’") unless defined $output;
|
||||
error($c, "Output is not available.") unless isValidPath $output->path;
|
||||
gone($c, "Output is no longer available.") unless isValidPath $output->path;
|
||||
|
||||
$c->response->header('Content-Disposition', "attachment; filename=\"build-${\$build->id}-${\$outputName}.nar.bz2\"");
|
||||
$c->stash->{current_view} = 'NixNAR';
|
||||
|
@ -230,10 +230,7 @@ sub nar :Local :Args(1) {
|
||||
|
||||
$path = ($ENV{NIX_STORE_DIR} || "/nix/store")."/$path";
|
||||
|
||||
if (!isValidPath($path)) {
|
||||
$c->response->status(410); # "Gone"
|
||||
error($c, "Path " . $path . " is no longer available.");
|
||||
}
|
||||
gone($c, "Path " . $path . " is no longer available.") unless isValidPath($path);
|
||||
|
||||
$c->stash->{current_view} = 'NixNAR';
|
||||
$c->stash->{storePath} = $path;
|
||||
|
Reference in New Issue
Block a user