Project

General

Profile

« Previous | Next » 

Revision 9812

Added by Matt Jones almost 8 years ago

Add small change to reset the content type of CSV files to text/csv when they are incorrectly set by Windows clients to an excel type. Addresses issues raised in Arctic Data ticket: https://github.nceas.ucsb.edu/KNB/arctic-data/issues/176.

View differences:

register-dataset.cgi
1365 1365
		debug( "Error receiving file " . cgi_error() );
1366 1366
	}
1367 1367

  
1368
	debug( "Process file: " . $fileName );
1369

  
1368 1370
	# write file to disk, get SHA1 hash and size
1369 1371
	my ( $outFile, $fileHash ) = writeFile($fileName);
1370 1372
	debug( "processed file to temp directory:  $outFile" );
......
1383 1385
	# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=313141
1384 1386
	if ( !$contentType ) {
1385 1387
		$contentType = 'text/plain';
1386
	}
1388
	} elsif ( $contentType =~ "application/vnd.ms-excel" && $fileName =~ /\.csv$/) {
1389
        	debug("Reassigning content type (" . $contentType . ")to CSV for file: " . $fileName);
1390
        	$contentType = 'text/csv';
1391
    	}
1387 1392

  
1388 1393
	my %dataInfo = (
1389 1394
		'fileName'    => $outFile,

Also available in: Unified diff