--- loncom/lonnet/perl/lonnet.pm 2004/03/16 20:15:08 1.477 +++ loncom/lonnet/perl/lonnet.pm 2004/03/16 21:29:31 1.478 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.477 2004/03/16 20:15:08 raeburn Exp $ +# $Id: lonnet.pm,v 1.478 2004/03/16 21:29:31 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1172,7 +1172,7 @@ sub tokenwrapper { $ENV{'user.environment'}=~/\/([^\/]+)\.id/; my $token=$1; # if ($uri=~/^uploaded\/([^\/]+)\/([^\/]+)\/([^\/]+)(\?\.*)*$/) { - if ($uri=~/^uploaded\/([^\/]+)\/([^\/]+)\/(.+)(\?\.*)*$/) { + if ($uri=~m|^uploaded/([^/]+)/([^/]+)/(.+)(\?\.*)*$|) { &appenv('userfile.'.$1.'/'.$2.'/'.$3 => $ENV{'request.course.id'}); return 'http://'.$hostname{ &homeserver($2,$1)}.'/'.$uri. (($uri=~/\?/)?'&':'?').'token='.$token. @@ -1182,20 +1182,24 @@ sub tokenwrapper { } } -# --------------- File operations in /home/httpd/html/userfiles/$domain/1/2/3/$course -# input: action, courseID, current domain, home server for course, intended path to file, -# source of file. +# --------- File operations in /home/httpd/html/userfiles/$domain/1/2/3/$course +# input: action, courseID, current domain, home server for course, intended +# path to file, source of file. # output: ok if successful, diagnostic message otherwise # -# Allows directory structure to be used within lonUsers/../userfiles/ for a course. +# Allows directory structure to be used within lonUsers/../userfiles/ for a +# course. # -# action = propagate - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file will -# be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles in course's home server. +# action = propagate - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file +# will be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles in +# course's home server. # -# action = copy - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file will be copied -# from $source (current location) to /home/httpd/html/userfiles/$domain/1/2/3/$course/$file -# and will then be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles/$file in -# course's home server. +# action = copy - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file will +# be copied from $source (current location) to +# /home/httpd/html/userfiles/$domain/1/2/3/$course/$file +# and will then be copied to +# /home/httpd/lonUsers/$domain/1/2/3/$course/userfiles/$file in +# course's home server. sub process_coursefile { my ($action,$docuname,$docudom,$docuhome,$file,$source)=@_; @@ -1207,11 +1211,11 @@ sub process_coursefile { my $fetchresult = ''; my $fpath = ''; my $fname = $file; - ($fpath,$fname) = ($file =~ m/^(.*)\/([^\/]+)$/); + ($fpath,$fname) = ($file =~ m|^(.*)/([^/]+)$|); $fpath=$docudom.'/'.$docuname.'/'.$fpath; my $filepath=$perlvar{'lonDocRoot'}.'/userfiles'; unless ($fpath eq '') { - my @parts=split(/\//,$fpath); + my @parts=split('/',$fpath); foreach my $part (@parts) { $filepath.= '/'.$part; if ((-e $filepath)!=1) {