Alright fixed more bugs
This commit is contained in:
parent
dcea6b2a24
commit
4fcd649b0b
1 changed files with 42 additions and 40 deletions
|
@ -86,15 +86,17 @@ post '/' => sub ($c) { handle_file($c) };
|
||||||
get '/f/:dir/#name' => sub ($c) {
|
get '/f/:dir/#name' => sub ($c) {
|
||||||
my $dir = $c->param("dir");
|
my $dir = $c->param("dir");
|
||||||
my $file = $c->param("name");
|
my $file = $c->param("name");
|
||||||
print $dir, $file . "\n";
|
|
||||||
my $ext = $file;
|
my $ext = $file;
|
||||||
$ext =~ s/.*\.//;
|
$ext =~ s/.*\.//;
|
||||||
$c->render_file( filepath => "f/".$dir . "/" . $file,
|
my $path = "f/".$dir . "/" . $file;
|
||||||
format => 'jpg',
|
#carp "sakisafe warning: could not get file: $ERRNO" unless
|
||||||
|
$c->render(text => "file not found", status => 404) unless -e $path;
|
||||||
|
$c->render_file( filepath => $path,
|
||||||
|
format => $ext,
|
||||||
content_disposition => 'inline'
|
content_disposition => 'inline'
|
||||||
);
|
)
|
||||||
};
|
|
||||||
|
|
||||||
|
};
|
||||||
app->max_request_size( 1024 * 1024 * 100 );
|
app->max_request_size( 1024 * 1024 * 100 );
|
||||||
|
|
||||||
post '/upload' => sub ($c) { handle_file($c) };
|
post '/upload' => sub ($c) { handle_file($c) };
|
||||||
|
|
Loading…
Add table
Reference in a new issue