From 86e8eba039a26ebf447dffcf75c92665bb379a48 Mon Sep 17 00:00:00 2001 From: Jamie McCarthy Date: Tue, 1 Jul 2003 20:42:05 +0000 Subject: [PATCH] slashstyle cleanup for URI scheme thing. --- Slash/Utility/Data/Data.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Slash/Utility/Data/Data.pm b/Slash/Utility/Data/Data.pm index a81deee0a..f1121da0b 100755 --- a/Slash/Utility/Data/Data.pm +++ b/Slash/Utility/Data/Data.pm @@ -1509,15 +1509,16 @@ sub fudgeurl { my $scheme = undef; $scheme = $uri->scheme if $uri && $uri->can("scheme"); + # modify scheme:/ to scheme:// for $schemes defined below + # need to recreate $uri after doing so to make userinfo + # clearing work for something like http:/foo.com...@bar.com + my $schemes_to_mod = { http=>1, https=>1, ftp=>1 }; + if ($scheme && $schemes_to_mod->{$scheme}) { + $url = $uri->canonical->as_string; + $url =~ s|^$scheme:/([^/])|$scheme://$1|; + $uri = new URI $url; + } - # modify scheme:/ to scheme:// for $schemes defined below - # need to recreate $uri after doing so to make userinfo - # clearing work for something like http:/foo.com...@bar.com - - my $schemes_to_mod = {http=>1,https=>1,ftp=>1}; - $url = $uri->canonical->as_string; - $url=~s|^$scheme:/([^/])|$scheme://$1| if $schemes_to_mod->{$scheme}; - $uri = new URI $url; if ($uri && !$scheme && $uri->can("authority") && $uri->authority) { # The URI has an authority but no scheme, e.g. "//sitename.com/". # URI.pm doesn't always handle this well. E.g. host() returns