[open-ils-commits] r10532 - trunk/Open-ILS/src/perlmods/OpenILS/WWW

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Sep 4 09:01:51 EDT 2008


Author: erickson
Date: 2008-09-04 09:01:50 -0400 (Thu, 04 Sep 2008)
New Revision: 10532

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/Vandelay.pm
Log:
sending headers via apache request content_type method, which seems to prevent the double headers issue.  verifying upload file exists before a read is attempted

Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/Vandelay.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/Vandelay.pm	2008-09-04 04:36:49 UTC (rev 10531)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/Vandelay.pm	2008-09-04 13:01:50 UTC (rev 10532)
@@ -56,25 +56,26 @@
 
 	return Apache2::Const::FORBIDDEN unless verify_login($auth);
 
-
+    my $data_fingerprint = '';
 	my $purpose = $cgi->param('purpose');
 	my $file = $cgi->param('marc_upload');
-	my $filename = "$file";
 
-	my $data = join '', (<$file>);
-	$data = encode_base64($data);
+    if($file and -e $file) {
 
-	my $data_fingerprint = md5_hex($data);
+	    my $data = join '', (<$file>);
+	    $data = encode_base64($data);
+    
+	    $data_fingerprint = md5_hex($data);
+    
+	    OpenSRF::Utils::Cache->new->put_cache(
+		    'vandelay_import_spool_' . $data_fingerprint,
+		    { purpose => $purpose, marc => $data }
+	    );
+    }
 
-	OpenSRF::Utils::Cache->new->put_cache(
-		'vandelay_import_spool_' . $data_fingerprint,
-		{ purpose => $purpose, marc => $data }
-	);
-
-	print "Content-type: text/plain; charset=utf-8\n\n$data_fingerprint";
-
+    $r->content_type('text/plain; charset=utf-8');
+	print "$data_fingerprint";
 	return Apache2::Const::OK;
-
 }
 
 sub verify_login {



More information about the open-ils-commits mailing list