--- loncom/lonnet/perl/lonnet.pm 2004/08/30 18:25:56 1.536 +++ loncom/lonnet/perl/lonnet.pm 2004/08/31 15:40:49 1.537 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.536 2004/08/30 18:25:56 sakharuk Exp $ +# $Id: lonnet.pm,v 1.537 2004/08/31 15:40:49 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -5056,15 +5056,18 @@ sub filelocation { $location = $file; $location =~ s:/~(.*?)/(.*):/home/$1/public_html/$2:; } elsif ($file=~/^\/*uploaded/) { # is an uploaded file - $file=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/(\/)?(.*)$/; - my $home=&homeserver($2,$1); - my $allowed=0; + my ($udom,$uname,$filename)= + ($file=~m|^/+uploaded/+([^/]+)/+([^/]+)/+(.*)$|); + my $home=&homeserver($uname,$udom); + my $is_me=0; my @ids=¤t_machine_ids(); - foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } - if ($allowed) { - $location=&Apache::loncommon::propath($1,$2).'/userfiles/'.$4; + foreach my $id (@ids) { if ($id eq $home) { $is_me=1; } } + if ($is_me) { + $location=&Apache::loncommon::propath($udom,$uname). + '/userfiles/'.$filename; } else { - $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1.'/'.$2.'/'.$4; + $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'. + $udom.'/'.$uname.'/'.$filename; } } else { $file=~s/^\Q$perlvar{'lonDocRoot'}\E//;