From e15479d9231bad168ac318aa2cbb43c705bc547c Mon Sep 17 00:00:00 2001 From: Artem Savkov Date: Wed, 13 Jul 2011 21:53:34 +0400 Subject: fix https urls shortening --- tinyurl-tabcomplete/complete-tiny-url.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tinyurl-tabcomplete') diff --git a/tinyurl-tabcomplete/complete-tiny-url.pl b/tinyurl-tabcomplete/complete-tiny-url.pl index b2d448f..45a00c0 100644 --- a/tinyurl-tabcomplete/complete-tiny-url.pl +++ b/tinyurl-tabcomplete/complete-tiny-url.pl @@ -123,7 +123,7 @@ sub match_uri { if ($text =~ $regex) { my $uri = $1; # shorten needs the http prefix or it'll treat it as a relative link. - $uri = 'http://' . $uri if $uri !~ m(http://); + $uri = 'http://' . $uri if $uri !~ m(https?://); return $uri; } else { # no match -- cgit v1.2.3 From 1b722bb1eac9c3a568de6f203ecd2277d1c1fd6b Mon Sep 17 00:00:00 2001 From: Artem Savkov Date: Thu, 14 Jul 2011 11:48:39 +0400 Subject: shortening support for protocols other than http(s) --- tinyurl-tabcomplete/complete-tiny-url.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tinyurl-tabcomplete') diff --git a/tinyurl-tabcomplete/complete-tiny-url.pl b/tinyurl-tabcomplete/complete-tiny-url.pl index 45a00c0..ad43c5e 100644 --- a/tinyurl-tabcomplete/complete-tiny-url.pl +++ b/tinyurl-tabcomplete/complete-tiny-url.pl @@ -123,7 +123,7 @@ sub match_uri { if ($text =~ $regex) { my $uri = $1; # shorten needs the http prefix or it'll treat it as a relative link. - $uri = 'http://' . $uri if $uri !~ m(https?://); + $uri = 'http://' . $uri if $uri !~ m([a-z][\w-]+:(?:/{1,3}|[a-z0-9%])); return $uri; } else { # no match -- cgit v1.2.3