[LON-CAPA-cvs] cvs: loncom /interface lonerrorhandler.pm

raeburn raeburn@source.lon-capa.org
Sun, 04 Jan 2009 19:49:19 -0000


raeburn		Sun Jan  4 19:49:19 2009 EDT

  Modified files:              
    /loncom/interface	lonerrorhandler.pm 
  Log:
  - Stop including the contents of uploaded files in the "environment" element in the Error Reporting web form.
  - Give the file size in MB instead.
  
  
Index: loncom/interface/lonerrorhandler.pm
diff -u loncom/interface/lonerrorhandler.pm:1.21 loncom/interface/lonerrorhandler.pm:1.22
--- loncom/interface/lonerrorhandler.pm:1.21	Fri Dec 12 23:03:04 2008
+++ loncom/interface/lonerrorhandler.pm	Sun Jan  4 19:49:19 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Internal Server Error Handler
 #
-# $Id: lonerrorhandler.pm,v 1.21 2008/12/12 23:03:04 raeburn Exp $
+# $Id: lonerrorhandler.pm,v 1.22 2009/01/04 19:49:19 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -105,6 +105,18 @@
 	my $env='';
 	my $syllabus='';
 
+	foreach $envkey (keys(%env)) {
+            if ($envkey =~ /^form\.(.+)\.filename$/) {
+                my $item = $1;
+                if (exists($env{'form.'.$item.'.mimetype'})) {
+                    if (exists($env{'form.'.$item})) {
+                        my $size = (length($env{'form.'.$item}))/(1024.0 * 1024.0);
+                        $env{'form.'.$item} = &mt('File (contents not shown) - size was [_1] MB.',sprintf("%.4f",$size));
+                    }
+                }
+            }
+        }
+
 	foreach $envkey (sort(keys(%env))) {
 	    $env.="$envkey: $env{$envkey}\n";
 	}