Fix redirect in Dancer to not forcibly apply scheme+host
This commit is contained in:
@@ -1,3 +1,13 @@
|
|||||||
|
2.019003 -
|
||||||
|
|
||||||
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
|
* Use cursor to greatly speed up macsuck/arpnip startup code (jeneric)
|
||||||
|
|
||||||
|
[BUG FIXES]
|
||||||
|
|
||||||
|
* Fix redirect in Dancer to not forcibly apply scheme+host
|
||||||
|
|
||||||
2.019002 - 2013-10-24
|
2.019002 - 2013-10-24
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|||||||
@@ -100,4 +100,15 @@ any qr{.*} => sub {
|
|||||||
template 'index';
|
template 'index';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
# https://github.com/PerlDancer/Dancer/issues/967
|
||||||
|
no warnings 'redefine';
|
||||||
|
*Dancer::_redirect = sub {
|
||||||
|
my ($destination, $status) = @_;
|
||||||
|
my $response = Dancer::SharedData->response;
|
||||||
|
$response->status($status || 302);
|
||||||
|
$response->headers('Location' => $destination);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
true;
|
true;
|
||||||
|
|||||||
@@ -55,9 +55,7 @@ foreach my $jobtype (keys %jobs_all, keys %jobs) {
|
|||||||
if exists $jobs{$jobtype} and not param('device');
|
if exists $jobs{$jobtype} and not param('device');
|
||||||
|
|
||||||
add_job($jobtype, param('device'), param('extra'));
|
add_job($jobtype, param('device'), param('extra'));
|
||||||
|
redirect uri_for('/admin/jobqueue')->path;
|
||||||
header(Location => uri_for('/admin/jobqueue')->path);
|
|
||||||
return status(302);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,8 +159,7 @@ get '/device' => require_login sub {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!defined $dev) {
|
if (!defined $dev) {
|
||||||
header(Location => uri_for('/', {nosuchdevice => 1})->path_query);
|
return redirect uri_for('/', {nosuchdevice => 1})->path_query;
|
||||||
return status(302);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
params->{'tab'} ||= 'details';
|
params->{'tab'} ||= 'details';
|
||||||
|
|||||||
@@ -66,8 +66,7 @@ get '/search' => require_login sub {
|
|||||||
|
|
||||||
if (not param('tab')) {
|
if (not param('tab')) {
|
||||||
if (not $q) {
|
if (not $q) {
|
||||||
header(Location => uri_for('/')->path);
|
return redirect uri_for('/')->path;
|
||||||
return status(302);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# pick most likely tab for initial results
|
# pick most likely tab for initial results
|
||||||
@@ -80,12 +79,11 @@ get '/search' => require_login sub {
|
|||||||
if ($nd and $nd->count) {
|
if ($nd and $nd->count) {
|
||||||
if ($nd->count == 1) {
|
if ($nd->count == 1) {
|
||||||
# redirect to device details for the one device
|
# redirect to device details for the one device
|
||||||
header(Location => uri_for('/device', {
|
return redirect uri_for('/device', {
|
||||||
tab => 'details',
|
tab => 'details',
|
||||||
q => ($nd->first->dns || $nd->first->ip),
|
q => ($nd->first->dns || $nd->first->ip),
|
||||||
f => '',
|
f => '',
|
||||||
})->path_query);
|
})->path_query;
|
||||||
return status(302);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# multiple devices
|
# multiple devices
|
||||||
|
|||||||
Reference in New Issue
Block a user