Skip to content
Snippets Groups Projects
Commit d70afdb1 authored by Glenn Proctor's avatar Glenn Proctor
Browse files

Gracefully handle zero-length files (e.g. current chimp SwissProt file)

parent 1c6cc033
No related branches found
No related tags found
No related merge requests found
......@@ -52,16 +52,25 @@ sub run {
my $result = system("wget", "--quiet", "--timestamping", "--directory-prefix=$dir", $url);
# compare checksums and parse/upload if necessary
# need to check file size as some .SPC files can be of zero length
my $file_cs = md5sum("$dir/$file");
if (!defined $checksum || $checksum ne $file_cs) {
print "Checksum for $file does not match, parsing\n";
if (-s "$dir/$file") {
update_source($dbi, $source_id, $file_cs, $file);
print "Checksum for $file does not match, parsing\n";
my $parserType = $filetype2parser{$type};
print "Parsing $file with $parserType\n";
$parserType->run("$dir/$file", $source_id);
#update_source($dbi, $source_id, $file_cs, $file);
my $parserType = $filetype2parser{$type};
print "Parsing $file with $parserType\n";
#$parserType->run("$dir/$file", $source_id);
} else {
print $file . " has zero length, skipping\n";
}
} else {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment