diff options
author | dakkar <dakkar@thenautilus.net> | 2011-04-05 21:31:09 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2011-04-05 21:31:09 +0100 |
commit | 6c2cc3b4ef6e2680e52b0d3f8b5ce857a24b4384 (patch) | |
tree | c0462a4f0309080b8a3f26d0ab503475ec480de3 | |
parent | charset (diff) | |
download | MyShorten-6c2cc3b4ef6e2680e52b0d3f8b5ce857a24b4384.tar.gz MyShorten-6c2cc3b4ef6e2680e52b0d3f8b5ce857a24b4384.tar.bz2 MyShorten-6c2cc3b4ef6e2680e52b0d3f8b5ce857a24b4384.zip |
better path handling
-rwxr-xr-x | cgi/shorten.pl | 3 |
1 files changed, 2 insertions, 1 deletions
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'); |