Allow dashes in jobset input names

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy
2013-09-23 17:53:35 -04:00
parent 6d5a3d0580
commit 1a313ad566
3 changed files with 6 additions and 6 deletions

View File

@ -248,7 +248,7 @@ sub nixExprPathFromParams {
error($c, "Invalid Nix expression path: $nixExprPath") if $nixExprPath !~ /^$relPathRE$/;
my $nixExprInput = trim $c->stash->{params}->{"nixexprinput"};
error($c, "Invalid Nix expression input name: $nixExprInput") unless $nixExprInput =~ /^\w+$/;
error($c, "Invalid Nix expression input name: $nixExprInput") unless $nixExprInput =~ /^[[:alpha:]][\w-]*$/;
return ($nixExprPath, $nixExprInput);
}
@ -309,7 +309,7 @@ sub updateJobset {
foreach my $inputName (keys %{$c->stash->{params}->{inputs}}) {
my $inputData = $c->stash->{params}->{inputs}->{$inputName};
error($c, "Invalid input name: $inputName") unless $inputName =~ /^[[:alpha:]]\w*$/;
error($c, "Invalid input name: $inputName") unless $inputName =~ /^[[:alpha:]][\w-]*$/;
my $inputType = $inputData->{type};

View File

@ -223,7 +223,7 @@ sub end : ActionClass('RenderView') {
}
if (scalar @{$c->error}) {
$c->stash->{resource} = { errors => "$c->error" };
$c->stash->{resource} = { errors => $c->error };
$c->stash->{template} = 'error.tt';
$c->stash->{errors} = $c->error;
$c->response->status(500) if $c->response->status == 200;