From 4fcd649b0b56514acaa8669eae192550e557728f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Palomares=20Pizarro?= Date: Sun, 12 Feb 2023 13:42:18 +0100 Subject: [PATCH] Alright fixed more bugs --- http/sakisafe.pl | 82 +++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/http/sakisafe.pl b/http/sakisafe.pl index 1ae1e6b..08156b7 100755 --- a/http/sakisafe.pl +++ b/http/sakisafe.pl @@ -86,53 +86,55 @@ post '/' => sub ($c) { handle_file($c) }; get '/f/:dir/#name' => sub ($c) { my $dir = $c->param("dir"); my $file = $c->param("name"); - print $dir, $file . "\n"; my $ext = $file; $ext =~ s/.*\.//; - $c->render_file( filepath => "f/".$dir . "/" . $file, - format => 'jpg', + my $path = "f/".$dir . "/" . $file; + #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' - ); + ) + }; + 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) }; + app->start; -app->start; + # Index template -# Index template - -#By default Mojolicious gets the "directory root" from the "public" -# directory, so the css and the favicon from the "public" directory, -# in the root of this repo. -__DATA__ + #By default Mojolicious gets the "directory root" from the "public" + # directory, so the css and the favicon from the "public" directory, + # in the root of this repo. + __DATA__ @@ index.html.ep - - - - sakisafe - - - - -
-

sakisafe

-

shitless file upload, pastebin and url shorter

- -

USAGE

-

POST a file:

- curl -F 'file=@yourfile.png' https://<%= $c->req->url->to_abs->host; %> -

Post your text directly

- curl -F 'file=@-' https://<%= $c->req->url->to_abs->host; %> -
-
-

Or just upload a file here

-
- - -
-
- - + + + +sakisafe + + + + +
+

sakisafe

+

shitless file upload, pastebin and url shorter

+ +

USAGE

+

POST a file:

+curl -F 'file=@yourfile.png' https://<%= $c->req->url->to_abs->host; %> +

Post your text directly

+curl -F 'file=@-' https://<%= $c->req->url->to_abs->host; %> +
+
+

Or just upload a file here

+
+ + +
+
+ +