Commit d7e75520 authored by Gary Wong's avatar Gary Wong
Browse files

Make getimages robust against "fetch -s" failure.

parent 8f373fd5
......@@ -268,10 +268,17 @@ foreach my $imageid (keys(%{ $xmlparse->{'image'} })) {
my $attempt = 1;
while( 1 ) {
print "Fetching $imageurl (attempt $attempt of $MAXATTEMPTS)...\n";
my $expectedsize = `$FETCH -s $imageurl`;
chomp( $expectedsize );
if( $expectedsize !~ /^[0-9]+$/ ) {
print "Could not retrieve image size, retrying...\n";
# Ignore exit code from fetch. Maybe we got lucky and got a
# good transfer before it died; maybe it gave up halfway through
# and we have half a good file and can continue where we left off.
my $expectedsize = `$FETCH -s $imageurl`;
system("$FETCH -a -F -R -r -o $tmpfilename $imageurl");
if( -s $tmpfilename < $expectedsize ) {
Markdown is supported
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