forked from lix-project/hydra
hydra: put contents links into html, add links to files from contents page
This commit is contained in:
parent
039d1bed21
commit
f35c9a4574
|
@ -204,7 +204,6 @@ sub download_by_type : Chained('build') PathPart('download-by-type') {
|
|||
$c->res->redirect(defaultUriForProduct($self, $c, $product, @path));
|
||||
}
|
||||
|
||||
|
||||
sub contents : Chained('build') PathPart Args(1) {
|
||||
my ($self, $c, $productnr) = @_;
|
||||
|
||||
|
@ -220,6 +219,10 @@ sub contents : Chained('build') PathPart Args(1) {
|
|||
if ($product->type eq "nix-build" && -d $path) {
|
||||
$res = `cd $path && find . -print0 | xargs -0 ls -ld --`;
|
||||
error($c, "`ls -lR' error: $?") if $? != 0;
|
||||
|
||||
my $baseuri = $c->uri_for('/build', $c->stash->{build}->id, 'download', $product->productnr);
|
||||
$baseuri .= "/".$product->name if $product->name;
|
||||
$res =~ s/(\.\/)($relPathRE)/<a href="$baseuri\/$2">$1$2<\/a>/g;
|
||||
}
|
||||
|
||||
elsif ($path =~ /\.rpm$/) {
|
||||
|
@ -259,8 +262,9 @@ sub contents : Chained('build') PathPart Args(1) {
|
|||
|
||||
die unless $res;
|
||||
|
||||
$c->stash->{'plain'} = { data => $res };
|
||||
$c->forward('Hydra::View::Plain');
|
||||
$c->stash->{title} = "Contents of ".$product->path;
|
||||
$c->stash->{contents} = "<pre>$res</pre>";
|
||||
$c->stash->{template} = 'plain.tt';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ sub robots_txt : Path('robots.txt') {
|
|||
, uri_for('Build', 'view_nixlog', ["*"], "*")
|
||||
, uri_for('Build', 'view_log', ["*"], "*")
|
||||
, uri_for('Build', 'view_log', ["*"])
|
||||
, uri_for('Build', 'download', ["*"], "*")
|
||||
, uri_for('Root', 'nar', [], "*")
|
||||
, uri_for('Root', 'status', [])
|
||||
, uri_for('Root', 'all', [])
|
||||
|
|
|
@ -206,7 +206,7 @@ sub trim {
|
|||
|
||||
|
||||
# Security checking of filenames.
|
||||
Readonly::Scalar our $pathCompRE => "(?:[A-Za-z0-9-\+][A-Za-z0-9-\+\._]*)";
|
||||
Readonly::Scalar our $pathCompRE => "(?:[A-Za-z0-9-\+\.][A-Za-z0-9-\+\._]*)";
|
||||
Readonly::Scalar our $relPathRE => "(?:$pathCompRE(?:/$pathCompRE)*)";
|
||||
Readonly::Scalar our $relNameRE => "(?:[A-Za-z0-9-][A-Za-z0-9-\.]*)";
|
||||
Readonly::Scalar our $attrNameRE => "(?:[A-Za-z_][A-Za-z0-9_]*)";
|
||||
|
|
Loading…
Reference in a new issue