--- loncom/lontrans.pm 2004/04/01 20:18:29 1.8 +++ loncom/lontrans.pm 2006/08/17 20:22:11 1.12 @@ -1,7 +1,7 @@ # The LearningOnline Network # URL translation for User Files # -# $Id: lontrans.pm,v 1.8 2004/04/01 20:18:29 raeburn Exp $ +# $Id: lontrans.pm,v 1.12 2006/08/17 20:22:11 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -32,18 +32,25 @@ use strict; use Apache::Constants qw(:common :remotehost); use Apache::lonnet(); use Apache::File(); -use Apache::loncommon; +use lib '/home/httpd/lib/perl'; +use LONCAPA; + sub handler { my $r = shift; + # FIXME line remove when mod_perl fixes BUG#4948 + $r->notes->set('error-notes' => ''); if ($r->uri=~m|^(/raw)?/uploaded/|) { my $fn = $r->uri(); $fn=~s/^\/raw//; my (undef,undef,$udom,$uname,@ufile)=split(/\//,$fn); - $ufile[-1]=~s/^[\~\.]+//; + if (@ufile) { $ufile[-1]=~s/^[\~\.]+//; } my $chome=&Apache::lonnet::homeserver($uname,$udom); - if ($chome eq $Apache::lonnet::perlvar{'lonHostID'}) { - $r->filename(&Apache::loncommon::propath($udom,$uname). + my $allowed=0; + my @ids=&Apache::lonnet::current_machine_ids(); + foreach my $id (@ids) { if ($id eq $chome) { $allowed=1; } } + if ($allowed) { + $r->filename(&propath($udom,$uname). '/userfiles/'.(join('/',@ufile))); } } elsif ($r->uri=~m|^/~|) {