* Support serving products that are directories (such as manuals or

[?]
Nov 12, 2008, 3:36 PM
MOCEUXZAS4CNZL2QDKGVTZCRZ6AMOO2WSFHJ4VPZPPPAXHANG4NAC

Dependencies

Change contents

  • replacement in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 166
    [2.24][2.24:79]()
    my ( $self, $c, $id, $productnr, $filename ) = @_;
    [2.24]
    [3.2595]
    my ( $self, $c, $id, $productnr, $filename, @path ) = @_;
  • replacement in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 174
    [2.359][2.359:454]()
    return error($c, "File " . $product->path . " has disappeared.") unless -e $product->path;
    [2.359]
    [2.454]
    return error($c, "Product " . $product->path . " has disappeared.") unless -e $product->path;
  • replacement in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 176
    [2.455][2.455:498]()
    $c->serve_static_file($product->path);
    [2.455]
    [2.498]
    # Security paranoia.
    foreach my $elem (@path) {
    if ($elem eq "." || $elem eq ".." || $elem !~ /^[\w\-\.]+$/) {
    return error($c, "Invalid filename $elem.");
    }
    }
    my $path = $product->path . "/" . join("/", @path);
    # If this is a directory but no "/" is attached, then redirect.
    if (-d $path && substr($c->request->uri, -1) ne "/") {
    return $c->res->redirect($c->request->uri . "/");
    }
    $path = "$path/index.html" if -d $path && -e "$path/index.html";
    if (!-e $path) {
    return error($c, "File $path does not exist.");
    }
    $c->serve_static_file($path);
  • edit in src/HydraFrontend/root/build.tt at line 197
    [3.8099]
    [3.8099]
  • edit in src/HydraFrontend/root/build.tt at line 200
    [3.8178]
    [3.1447]
  • edit in src/HydraFrontend/root/build.tt at line 229
    [3.3533]
    [3.1895]
    [% CASE "report" %]
    <a href="[% c.uri_for('/download' build.id product.productnr product.name) %]">
    [% SWITCH product.subtype %]
    [% CASE "coverage" %]
    Code coverage analysis report
    [% CASE DEFAULT %]
    Report of type <tt>[% product.subtype %]</tt>
    [% END %]
    </a>
  • edit in src/HydraFrontend/root/build.tt at line 243
    [3.1970]
    [3.8178]
  • edit in src/HydraFrontend/root/hydra.css at line 181
    [3.316][3.316:317]()
  • edit in src/HydraFrontend/root/hydra.css at line 182
    [3.319]
    [3.319]
  • replacement in src/build.pl at line 224
    [3.3767][3.3767:3840]()
    my $st = stat($path) or die "cannot stat $path: $!";
    [3.3767]
    [3.3840]
    my $fileSize, my $sha1, my $sha256;
  • replacement in src/build.pl at line 226
    [3.3841][3.3841:3998]()
    my $sha1 = `nix-hash --flat --type sha1 $path`
    or die "cannot hash $path: $?";;
    chomp $sha1;
    [3.3841]
    [3.3998]
    if (-f $path) {
    my $st = stat($path) or die "cannot stat $path: $!";
    $fileSize = $st;
    $sha1 = `nix-hash --flat --type sha1 $path`
    or die "cannot hash $path: $?";;
    chomp $sha1;
  • replacement in src/build.pl at line 234
    [3.4019][3.4019:4182]()
    my $sha256 = `nix-hash --flat --type sha256 $path`
    or die "cannot hash $path: $?";;
    chomp $sha256;
    [3.4019]
    [3.4182]
    $sha256 = `nix-hash --flat --type sha256 $path`
    or die "cannot hash $path: $?";;
    chomp $sha256;
    }
  • replacement in src/build.pl at line 245
    [3.6257][3.4257:4305]()
    , filesize => $st->size
    [3.6257]
    [3.4305]
    , filesize => $fileSize