[LON-CAPA-cvs] cvs: loncom /publisher lonupload.pm

foxr lon-capa-cvs@mail.lon-capa.org
Thu, 08 Aug 2002 02:30:40 -0000


foxr		Wed Aug  7 22:30:40 2002 EDT

  Modified files:              
    /loncom/publisher	lonupload.pm 
  Log:
  BUG 442 - map %20 to ' ' in filenames.
  
  
  
Index: loncom/publisher/lonupload.pm
diff -u loncom/publisher/lonupload.pm:1.11 loncom/publisher/lonupload.pm:1.12
--- loncom/publisher/lonupload.pm:1.11	Sun Aug  4 22:22:56 2002
+++ loncom/publisher/lonupload.pm	Wed Aug  7 22:30:39 2002
@@ -1,7 +1,8 @@
+
 # The LearningOnline Network with CAPA
 # Handler to upload files into construction space
 #
-# $Id: lonupload.pm,v 1.11 2002/08/05 02:22:56 foxr Exp $
+# $Id: lonupload.pm,v 1.12 2002/08/08 02:30:39 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -55,6 +56,24 @@
 use Apache::Constants qw(:common :http :methods);
 use Apache::loncacc;
 use Apache::loncommon();
+use Apache::Log();
+
+my $DEBUG=0;
+
+sub Debug {
+  
+  # Marshall the parameters.
+  
+  my $r       = shift;
+  my $log     = $r->log;
+  my $message = shift;
+  
+  # Put out the indicated message butonly if DEBUG is false.
+  
+  if ($DEBUG) {
+    $log->debug($message);
+  }
+}
 
 sub upfile_store {
     my $r=shift;
@@ -85,7 +104,8 @@
     $fn.=$ENV{'form.upfile.filename'};
     $fn=~s/^\///;
     $fn=~s/(\/)+/\//g;
-
+    $fn=~s/%20/ /g;
+    &Debug($r, "Filename for upload: $fn");
     if (($fn) && ($fn!~/\/$/)) {
       $r->print(
  '<form action=/adm/upload method=post>'.