From 6c2cc3b4ef6e2680e52b0d3f8b5ce857a24b4384 Mon Sep 17 00:00:00 2001 From: dakkar Date: Tue, 5 Apr 2011 21:31:09 +0100 Subject: better path handling --- cgi/shorten.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cgi/shorten.pl') diff --git a/cgi/shorten.pl b/cgi/shorten.pl index b87bfc2..064d618 100755 --- a/cgi/shorten.pl +++ b/cgi/shorten.pl @@ -105,6 +105,7 @@ sub urldecode { my $q=CGI->new(); my $path=$q->path_info()||''; +$path=~s{^/}{}; my $url=$q->param('url'); if ($url) { @@ -122,7 +123,7 @@ else { else { $path=decode('utf8',$path); } - my ($short,$rest) = ($path =~ m{^/(\w+)(.*)$}); + my ($short,$rest) = ($path =~ m{^(\w+)(.*)$}); my $url=lengthen($short); if ($url eq '404') { say $q->header(-type=>'text/plain'); -- cgit v1.2.3