Small bugfixes

Production always gives surprises !
This commit is contained in:
Luc Didry
2014-06-01 18:59:34 +02:00
parent 673d80cec2
commit 510bfb3eed
3 changed files with 531 additions and 495 deletions
+524 -489
View File
File diff suppressed because it is too large Load Diff
+1 -5
View File
@@ -86,11 +86,7 @@ sub startup {
my $c = shift;
my $ip_only = shift || 0;
my $proxy = '';
my @x_forward = $c->req->headers->header('X-Forwarded-For');
for my $x (@x_forward) {
$proxy .= join(', ', @$x);
}
my $proxy = $c->req->headers->header('X-Forwarded-For');
my $ip = ($proxy) ? $proxy : $c->tx->remote_address;
+6 -1
View File
@@ -55,7 +55,7 @@ sub delete {
if (scalar(@images)) {
my $image = $images[0];
my $msg;
if ($image->mod_token() ne $token) {
if ($image->mod_token() ne $token || $token eq '') {
$msg = $c->l('invalid_token');
} elsif ($image->enabled() == 0) {
$msg = $c->l('already_deleted', $image->filename);
@@ -227,6 +227,11 @@ sub add {
# Give url to user
$short = $records[0]->short;
$real_short = $short;
if (!defined($records[0]->mod_token)) {
$records[0]->update(
mod_token => $c->shortener($c->config->{token_length})
);
}
$token = $records[0]->mod_token;
$short .= '/'.$key if (defined($key));
} else {