--- loncom/publisher/loncfile.pm 2002/07/29 01:55:51 1.13 +++ loncom/publisher/loncfile.pm 2002/08/24 03:56:58 1.15 @@ -7,10 +7,10 @@ # presents a page that describes the proposed action to the user # and requests confirmation. The second phase commits the action # and displays a page showing the results of the action. -# +# # -# $Id: loncfile.pm,v 1.13 2002/07/29 01:55:51 foxr Exp $ +# $Id: loncfile.pm,v 1.15 2002/08/24 03:56:58 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -86,10 +86,12 @@ package Apache::loncfile; use strict; use Apache::File; +use File::Basename; use File::Copy; use Apache::Constants qw(:common :http :methods); use Apache::loncacc; use Apache::Log (); +use Apache::lonnet; my $DEBUG=0; my $r; # Needs to be global for some stuff RF. @@ -856,9 +858,13 @@ sub Copy2 { &Debug($request ,"Will try to copy $oldfile to $newfile"); if(-e $oldfile) { unless (copy($oldfile, $newfile)) { - $request->print(' Error: '.$!.''); + $request->print(' copy Error: '.$!.''); return 0; } else { + unless (chmod(0660, $newfile)) { + $request->print(' chmod error: '.$!.''); + return 0; + } return 1; } } else { @@ -1012,6 +1018,12 @@ sub phasetwo { &Debug($r, "Final url is: $dest"); $dest =~ s/\/home\//\/priv\//; $dest =~ s/\/public_html//; + + my $base = &Apache::lonnet::escape(&File::Basename::basename($dest)); + my $dpath= &File::Basename::dirname($dest); + $dest = $dpath.'/'.$base; + + &Debug($r, "Final url after rewrite: $dest"); $r->print('

Done

');