From e499fe9df8b1db6f07e6849a7144dbddff516a97 Mon Sep 17 00:00:00 2001 From: Matthew Connelly Date: Sat, 14 Nov 2015 07:22:21 +0000 Subject: [PATCH] fixed the /utterly stupid/ bug where pastes would not show at all. turns out i forgot about the change in parameter handling in getpaste --- lib/App/WerePaste.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/App/WerePaste.pm b/lib/App/WerePaste.pm index 89f2d88..3958b8b 100644 --- a/lib/App/WerePaste.pm +++ b/lib/App/WerePaste.pm @@ -49,7 +49,8 @@ sub ValidateParams { return 1; } sub GetPaste { - my $id = shift; $id = lc $id; + my $params = shift; + my $id = lc $params->{id}; return undef unless $id =~ /^[a-f0-9]*$/; return schema->resultset('Paste')->single({ id => $id }); } @@ -77,9 +78,9 @@ hook 'before' => sub { CheckExpiry(); }; # Routes #get get '/' => sub { template 'index.tt'; }; -get '/:id' => sub { my $paste=GetPaste(scalar params('route')) or pass; template 'show.tt', { paste => $paste }; }; -get '/:id/copy' => sub { my $paste=GetPaste(scalar params('route')) or pass; template 'index.tt', { paste => $paste }; }; -get '/:id/raw' => sub { my $paste=GetPaste(scalar params('route')) or pass; content_type 'text/plain'; return $paste->code; }; +get '/:id' => sub { my $paste=GetPaste(scalar params 'route') or pass; template 'show.tt', { paste => $paste }; }; +get '/:id/copy' => sub { my $paste=GetPaste(scalar params 'route') or pass; template 'index.tt', { paste => $paste }; }; +get '/:id/raw' => sub { my $paste=GetPaste(scalar params 'route') or pass; content_type 'text/plain'; return $paste->code; }; #post post '/' => sub { my $p = params 'body';