Bug 35173: Correctly concat error strings

This patch moves the call to $sftp->error outside of the double quote
string and into a . concat to properly expose the error message as
apposed to outputting 'Net::SFTP::Foreign=HASH(0x559c9118f0c8)->error'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2023-10-27 11:48:07 +01:00 committed by Tomas Cohen Arazi
parent 67f4fcc204
commit 43bd124f87
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 5 additions and 5 deletions

View File

@ -148,10 +148,10 @@ sub sftp_download {
}
$sftp->setcwd( $self->{account}->download_directory )
or return $self->_abort_download( $sftp,
"Cannot change remote dir : $sftp->error" );
"Cannot change remote dir: " . $sftp->error );
my $file_list = $sftp->ls()
or return $self->_abort_download( $sftp,
"cannot get file list from server: $sftp->error" );
"cannot get file list from server: " . $sftp->error );
foreach my $file ( @{$file_list} ) {
my $filename = $file->{filename};
@ -159,7 +159,7 @@ sub sftp_download {
$sftp->get( $filename, "$self->{working_dir}/$filename" );
if ( $sftp->error ) {
$self->_abort_download( $sftp,
"Error retrieving $filename: $sftp->error" );
"Error retrieving $filename: " . $sftp->error );
last;
}
push @downloaded_files, $filename;
@ -170,7 +170,7 @@ sub sftp_download {
my $ret = $sftp->rename( $filename, $processed_name );
if ( !$ret ) {
$self->_abort_download( $sftp,
"Error renaming $filename: $sftp->error" );
"Error renaming $filename: " . $sftp->error );
last;
}
@ -302,7 +302,7 @@ sub sftp_upload {
$sftp->die_on_error("Cannot ssh to $self->{account}->host");
$sftp->setcwd( $self->{account}->upload_directory )
or return $self->_abort_download( $sftp,
"Cannot change remote dir : $sftp->error" );
"Cannot change remote dir : " . $sftp->error );
foreach my $m (@messages) {
my $content = $m->raw_msg;
if ($content) {