summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2011-04-05 21:31:09 +0100
committerdakkar <dakkar@thenautilus.net>2011-04-05 21:31:09 +0100
commit6c2cc3b4ef6e2680e52b0d3f8b5ce857a24b4384 (patch)
treec0462a4f0309080b8a3f26d0ab503475ec480de3
parentcharset (diff)
downloadMyShorten-6c2cc3b4ef6e2680e52b0d3f8b5ce857a24b4384.tar.gz
MyShorten-6c2cc3b4ef6e2680e52b0d3f8b5ce857a24b4384.tar.bz2
MyShorten-6c2cc3b4ef6e2680e52b0d3f8b5ce857a24b4384.zip
better path handling
-rwxr-xr-xcgi/shorten.pl3
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');