diff --git a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm index 8fac493e..c7608337 100644 --- a/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm +++ b/src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm @@ -162,6 +162,21 @@ sub loadLog { } +sub download :Local { + my ( $self, $c, $id, $productnr, $filename ) = @_; + + my $build = getBuild($c, $id); + return error($c, "Build with ID $id doesn't exist.") if !defined $build; + + my $product = $build->buildproducts->find({productnr => $productnr}); + return error($c, "Build $id doesn't have a product $productnr.") if !defined $product; + + return error($c, "File " . $product->path . " has disappeared.") unless -e $product->path; + + $c->serve_static_file($product->path); +} + + sub end : ActionClass('RenderView') {} diff --git a/src/HydraFrontend/root/build.tt b/src/HydraFrontend/root/build.tt index a859ef97..672c01fc 100644 --- a/src/HydraFrontend/root/build.tt +++ b/src/HydraFrontend/root/build.tt @@ -197,14 +197,16 @@ [% CASE "nix-build" %] Nix build of path [% product.path %] [% CASE "file" %] - [% SWITCH product.subtype %] - [% CASE "source-dist" %] - Source Source distribution [% product.name %] - [% CASE "rpm" %] - RPM RPM package [% product.name %] - [% CASE DEFAULT %] - File [% product.path %] of type [% product.subtype %] - [% END %] + + [% SWITCH product.subtype %] + [% CASE "source-dist" %] + Source Source distribution [% product.name %] + [% CASE "rpm" %] + RPM RPM package [% product.name %] + [% CASE DEFAULT %] + File [% product.name %] of type [% product.subtype %] + [% END %] + [details]