--- loncom/lontrans.pm 2003/03/26 00:03:21 1.5 +++ loncom/lontrans.pm 2003/11/12 21:37:07 1.6 @@ -1,7 +1,7 @@ # The LearningOnline Network # URL translation for User Files # -# $Id: lontrans.pm,v 1.5 2003/03/26 00:03:21 albertel Exp $ +# $Id: lontrans.pm,v 1.6 2003/11/12 21:37:07 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -32,24 +32,15 @@ use strict; use Apache::Constants qw(:common :remotehost); use Apache::lonnet(); use Apache::File(); - -sub propath { - my ($udom,$uname)=@_; - $udom=~s/\W//g; - $uname=~s/\W//g; - my $subdir=$uname.'__'; - $subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/; - my $proname="$Apache::lonnet::perlvar{'lonUsersDir'}/$udom/$subdir/$uname"; - return $proname; -} - +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(&propath($udom,$uname).'/userfiles/'.$ufile); + $r->filename(&Apache::loncommon::propath($udom,$uname). + '/userfiles/'.$ufile); } elsif ($r->uri=~m|^/~|) { #internal authentication, needs fixup. my $fn = $r->uri(); # non users do not get the full path request