Use query_params instead of params

Otherwise crazy things happen with POST requests from GitHub.
This commit is contained in:
Eelco Dolstra 2013-02-26 00:38:18 +01:00
parent 5e6896b2d9
commit 11d87c6f82

View file

@ -287,6 +287,7 @@ sub logdiff : Chained('api') PathPart('logdiff') Args(2) {
sub triggerJobset { sub triggerJobset {
my ($self, $c, $jobset) = @_; my ($self, $c, $jobset) = @_;
print STDERR "triggering jobset ", $jobset->project->name . ":" . $jobset->name, "\n";
txn_do($c->model('DB')->schema, sub { txn_do($c->model('DB')->schema, sub {
$jobset->update({ triggertime => time }); $jobset->update({ triggertime => time });
}); });
@ -299,7 +300,7 @@ sub push : Chained('api') PathPart('push') Args(0) {
$c->{stash}->{json}->{jobsetsTriggered} = []; $c->{stash}->{json}->{jobsetsTriggered} = [];
my @jobsets = split /,/, ($c->request->params->{jobsets} // ""); my @jobsets = split /,/, ($c->request->query_params->{jobsets} // "");
foreach my $s (@jobsets) { foreach my $s (@jobsets) {
my ($p, $j) = parseJobsetName($s); my ($p, $j) = parseJobsetName($s);
my $jobset = $c->model('DB::Jobsets')->find($p, $j) or notFound($c, "Jobset $p:$j does not exist."); my $jobset = $c->model('DB::Jobsets')->find($p, $j) or notFound($c, "Jobset $p:$j does not exist.");
@ -307,7 +308,7 @@ sub push : Chained('api') PathPart('push') Args(0) {
triggerJobset($self, $c, $jobset); triggerJobset($self, $c, $jobset);
} }
my @repos = split /,/, ($c->request->params->{repos} // ""); my @repos = split /,/, ($c->request->query_params->{repos} // "");
foreach my $r (@repos) { foreach my $r (@repos) {
triggerJobset($self, $c, $_) foreach $c->model('DB::Jobsets')->search( triggerJobset($self, $c, $_) foreach $c->model('DB::Jobsets')->search(
{ 'project.enabled' => 1, 'me.enabled' => 1 }, { 'project.enabled' => 1, 'me.enabled' => 1 },