[LON-CAPA-cvs] cvs: loncom /auth lonacc.pm /interface loncommon.pm portfolio.pm
raeburn
raeburn@source.lon-capa.org
Fri, 29 Oct 2010 20:41:49 -0000
raeburn Fri Oct 29 20:41:49 2010 EDT
Modified files:
/loncom/interface portfolio.pm loncommon.pm
/loncom/auth lonacc.pm
Log:
- No upload to portfolio if uploaded file was zero bytes.
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.226 loncom/interface/portfolio.pm:1.227
--- loncom/interface/portfolio.pm:1.226 Wed Oct 27 01:02:29 2010
+++ loncom/interface/portfolio.pm Fri Oct 29 20:41:43 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.226 2010/10/27 01:02:29 raeburn Exp $
+# $Id: portfolio.pm,v 1.227 2010/10/29 20:41:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1937,7 +1937,8 @@
$port_path,$disk_quota,
$current_disk_usage,$uname,$udom);
if ($state eq 'will_exceed_quota'
- || $state eq 'file_locked') {
+ || $state eq 'file_locked'
+ || $state eq 'zero_bytes') {
$r->print($msg.&done('Back',$url));
return;
}
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.984 loncom/interface/loncommon.pm:1.985
--- loncom/interface/loncommon.pm:1.984 Wed Oct 27 01:04:10 2010
+++ loncom/interface/loncommon.pm Fri Oct 29 20:41:43 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.984 2010/10/27 01:04:10 raeburn Exp $
+# $Id: loncommon.pm,v 1.985 2010/10/29 20:41:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -8560,7 +8560,17 @@
sub check_for_upload {
my ($path,$fname,$group,$element,$portfolio_root,$port_path,
$disk_quota,$current_disk_usage,$uname,$udom) = @_;
- my $filesize = (length($env{'form.'.$element})) / 1000; #express in k (1024?)
+ my $filesize = length($env{'form.'.$element});
+ if (!$filesize) {
+ my $msg = '<span class="LC_error">'.
+ &mt('Unable to upload [_1]. (size = [_2] bytes)',
+ '<span class="LC_filename">'.$fname.'</span>',
+ $filesize).'<br />'.
+ &mt('Either the file you uploaded was empty, or your web browser was unable to read its contents.').'<br />';
+ '</span>';
+ return ('zero_bytes',$msg);
+ }
+ $filesize = $filesize/1000; #express in k (1024?)
my $getpropath = 1;
my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$path,$udom,$uname,
$getpropath);
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.134 loncom/auth/lonacc.pm:1.135
--- loncom/auth/lonacc.pm:1.134 Mon Mar 29 13:31:01 2010
+++ loncom/auth/lonacc.pm Fri Oct 29 20:41:49 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Cookie Based Access Handler
#
-# $Id: lonacc.pm,v 1.134 2010/03/29 13:31:01 raeburn Exp $
+# $Id: lonacc.pm,v 1.135 2010/10/29 20:41:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -156,7 +156,7 @@
for ($i=0;$i<=$#lines;$i++) {
if ($lines[$i]=~/^--\Q$contentsep\E/) {
if ($name) {
- chomp($value);
+ $value=~s/[\r\n]+$//;
if (ref($fields) eq 'ARRAY') {
next if (!grep(/^\Q$name\E$/,@{$fields}));
}