--- loncom/lontrans.pm 2003/11/12 21:37:07 1.6 +++ loncom/lontrans.pm 2006/01/16 19:27:09 1.10 @@ -1,7 +1,7 @@ # The LearningOnline Network # URL translation for User Files # -# $Id: lontrans.pm,v 1.6 2003/11/12 21:37:07 albertel Exp $ +# $Id: lontrans.pm,v 1.10 2006/01/16 19:27:09 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,11 +36,19 @@ use Apache::loncommon; sub handler { my $r = shift; - if ($r->uri=~m|^/uploaded/|) { - my (undef,undef,$udom,$uname,$ufile)=split(/\//,$r->uri); - $ufile=~s/^[\~\.]+//; - $r->filename(&Apache::loncommon::propath($udom,$uname). - '/userfiles/'.$ufile); + if ($r->uri=~m|^(/raw)?/uploaded/|) { + my $fn = $r->uri(); + $fn=~s/^\/raw//; + my (undef,undef,$udom,$uname,@ufile)=split(/\//,$fn); + if (@ufile) { $ufile[-1]=~s/^[\~\.]+//; } + my $chome=&Apache::lonnet::homeserver($uname,$udom); + my $allowed=0; + my @ids=&Apache::lonnet::current_machine_ids(); + foreach my $id (@ids) { if ($id eq $chome) { $allowed=1; } } + if ($allowed) { + $r->filename(&Apache::loncommon::propath($udom,$uname). + '/userfiles/'.(join('/',@ufile))); + } } elsif ($r->uri=~m|^/~|) { #internal authentication, needs fixup. my $fn = $r->uri(); # non users do not get the full path request