Skip to content
Snippets Groups Projects

Check response status code instead of message for file fetch requests

Merged Marek Szuba requested to merge github/fork/imransl/master into master
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
@@ -341,7 +341,7 @@ sub fetch_file {
my $dest = $args->{'destination_path'} ? $args->{'destination_path'}."$filename" : "/tmp/$filename";
my $response = $ua->mirror($file_url, $dest);
return $dest if ($response->{_msg} eq 'OK');
return $dest if ($response->{_rc} == 200);
if($args->{'nice'}) {
return {'error' => "Cannot download file ($file_url). HTTP request error code ".$response->{_rc}};