diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index d324ed2c..083d5f39 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -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; diff --git a/src/root/product-list.tt b/src/root/product-list.tt index 7311cbfa..01c55acb 100644 --- a/src/root/product-list.tt +++ b/src/root/product-list.tt @@ -2,6 +2,10 @@ [% BLOCK renderProductList -%] + [% # Work around a strange bug: build.buildproducts.size returns 3 when the actual size is 1. + nrProducts = 0; FOREACH product IN build.buildproducts; nrProducts = nrProducts + 1; END + %] +