* Allow omitting the product number if there is only one product in a

build.  This allows URLs like

    http://server/job/patchelf/trunk/deb_debian40i386/latest/download

  or

    http://server/release/patchelf/unstable/latest/deb_debian40i386/download
This commit is contained in:
Eelco Dolstra
2009-04-08 09:37:05 +00:00
parent 11d8421def
commit bf2a5a2629
2 changed files with 17 additions and 6 deletions

View File

@ -102,8 +102,10 @@ sub defaultUriForProduct {
sub download : Chained('build') PathPart {
my ($self, $c, $productnr, @path) = @_;
$productnr = 1 if !defined $productnr;
my $product = $c->stash->{build}->buildproducts->find({productnr => $productnr});
notFound($c, "Build doesn't have a product $productnr.") if !defined $product;
notFound($c, "Build doesn't have a product #$productnr.") if !defined $product;
notFound($c, "Product " . $product->path . " has disappeared.") unless -e $product->path;