--- loncom/publisher/lonpublisher.pm 2007/02/01 02:38:05 1.219 +++ loncom/publisher/lonpublisher.pm 2007/03/02 23:20:17 1.222 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.219 2007/02/01 02:38:05 albertel Exp $ +# $Id: lonpublisher.pm,v 1.222 2007/03/02 23:20:17 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -409,15 +409,16 @@ sub urlfixup { if ($url =~ /^mailto:/i) { return $url; } #internal document links need no fixing if ($url =~ /^\#/) { return $url; } - my ($host)=($url=~/(?:http\:\/\/)*([^\/]+)/); - foreach (values %Apache::lonnet::hostname) { - if ($_ eq $host) { - $url=~s/^http\:\/\///; - $url=~s/^$host//; + my ($host)=($url=~/(?:(?:http|https|ftp)\:\/\/)*([^\/]+)/); + my %all_hostnames = &Apache::lonnet::all_hostnames(); + foreach my $hostname (values(%all_hostnames)) { + if ($hostname eq $host) { + $url=~s/^(?:http|https|ftp)\:\/\///; + $url=~s/^\Q$host\E//; } } - if ($url=~/^http\:\/\//) { return $url; } - $url=~s/\~$cuname/res\/$cudom\/$cuname/; + if ($url=~/^(?:http|https|ftp)\:\/\//) { return $url; } + $url=~s{\Q~$cuname\E}{res/$cudom/$cuname}; return $url; } @@ -468,7 +469,7 @@ sub set_allow { } if (($newurl !~ /^javascript:/i) && ($newurl !~ /^mailto:/i) && - ($newurl !~ /^http:/i) && + ($newurl !~ /^(?:http|https|ftp):/i) && ($newurl !~ /^\#/)) { $$allow{&absoluteurl($newurl,$target)}=1; }