mirror of
https://framagit.org/fiat-tux/hat-softwares/lutim.git
synced 2026-07-04 17:01:54 +02:00
Fix bugs
* IO::Socket::SSL dependancy for HTTPS downloads by URL * error message if the downloaded by URL image is too big * typo in internationalization call
This commit is contained in:
@@ -19,7 +19,7 @@ LUTIm's logo is an adaptation of [Lutin](http://commons.wikimedia.org/wiki/File:
|
||||

|
||||
|
||||
##Dependencies
|
||||
* Carton : Perl dependencies manager, it will get what you need, so don't bother for dependencies (but you can read the file `cpanfile` if you want).
|
||||
* Carton : Perl dependencies manager, it will get what you need, so don't bother for Perl modules dependencies (but you can read the file `cpanfile` if you want).
|
||||
|
||||
```shell
|
||||
sudo cpan Carton
|
||||
@@ -31,6 +31,12 @@ or
|
||||
sudo apt-get install carton
|
||||
```
|
||||
|
||||
* But, on another hand, some modules that Carton will install need to be compiled. So you will need some tools:
|
||||
|
||||
```shell
|
||||
sudo apt-get install build-essential libssl-dev
|
||||
```
|
||||
|
||||
###Thumbnails dependancy
|
||||
If you want to provide thumbnails of uploaded images, you have to install the *ImageMagick* image manipulation software (<http://www.imagemagick.org/>) and the Image::Magick CPAN module.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
requires 'Mojolicious';
|
||||
requires 'IO::Socket::SSL';
|
||||
requires 'Data::Validate::URI';
|
||||
requires 'Mojolicious::Plugin::I18N';
|
||||
requires 'ORLite';
|
||||
|
||||
+20
-2
@@ -67,12 +67,30 @@ sub add {
|
||||
$filename = 'uploaded.image' unless (defined($filename));
|
||||
$filename .= '.image' if (index($filename, '.') == -1);
|
||||
$upload = Mojo::Upload->new(
|
||||
asset => $tx->res->content->asset,
|
||||
asset => $res->content->asset,
|
||||
filename => $filename
|
||||
);
|
||||
$c->app->{wait_for_it}->{$c->ip} = time;
|
||||
} elsif ($tx->res->is_limit_exceeded) {
|
||||
my $msg = $c->l('file_too_big', $tx->res->max_message_size);
|
||||
if (defined($c->param('format')) && $c->param('format') eq 'json') {
|
||||
return $c->render(
|
||||
json => {
|
||||
success => Mojo::JSON->false,
|
||||
msg => {
|
||||
filename => $file_url,
|
||||
msg => $msg
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
$c->flash(msg => $msg);
|
||||
$c->flash(filename => $upload->filename);
|
||||
return $c->redirect_to('/');
|
||||
}
|
||||
} else {
|
||||
my $msg = $c->l('download_error');
|
||||
$c->app->log->warn('[DOWNLOAD ERROR]'.$c->dumper($tx->error));
|
||||
if (defined($c->param('format')) && $c->param('format') eq 'json') {
|
||||
return $c->render(
|
||||
json => {
|
||||
@@ -121,7 +139,7 @@ sub add {
|
||||
mkdir('files', 0700) unless (-d 'files');
|
||||
|
||||
if ($c->req->is_limit_exceeded) {
|
||||
$msg = l('file_too_big', $c->req->max_message_size);
|
||||
$msg = $c->l('file_too_big', $c->req->max_message_size);
|
||||
if (defined($c->param('format')) && $c->param('format') eq 'json') {
|
||||
return $c->render(
|
||||
json => {
|
||||
|
||||
Reference in New Issue
Block a user