* 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:
parent
11d8421def
commit
bf2a5a2629
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
%]
|
||||
|
||||
<ul class="productList">
|
||||
|
||||
[% FOREACH product IN build.buildproducts -%]
|
||||
|
@ -108,11 +112,16 @@
|
|||
<tr>
|
||||
<th>Links to latest:</th>
|
||||
<td>
|
||||
[% IF nrProducts > 1 %]
|
||||
[% uri2 = "${c.uri_for(latestRoot.join('/') 'download-by-type' product.type product.subtype)}" %]
|
||||
<a href="[% uri2 %]"><tt>[% uri2 %]</tt></a>
|
||||
<br />
|
||||
[% uri2 = "${c.uri_for(latestRoot.join('/') 'download' product.productnr)}" %]
|
||||
<a href="[% uri2 %]"><tt>[% uri2 %]</tt></a>
|
||||
[% ELSE %]
|
||||
[% uri2 = "${c.uri_for(latestRoot.join('/') 'download')}" %]
|
||||
<a href="[% uri2 %]"><tt>[% uri2 %]</tt></a>
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
<tr><th>File size:</th><td>[% product.filesize %] bytes ([% mibs(product.filesize / (1024 * 1024)) %] MiB)</td></tr>
|
||||
|
|
Loading…
Reference in a new issue