From 612568742612333d260492a6f49ff867effc03d1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 16 Oct 2025 10:19:38 -0400 Subject: [PATCH] Bug 41020: Standardize _abort_operation() signature in FTP transport This patch updates Koha::File::Transport::FTP::_abort_operation() to accept an optional $path parameter, matching the signature used in Koha::File::Transport::SFTP. This improves error reporting by including the path/file that caused the operation to fail in the error message payload. Previously, the FTP implementation only included the error detail and message, making it harder to debug which file or directory caused the problem. Changes: - Updated _abort_operation($operation) to _abort_operation($operation, $path) - Updated change_directory() call to pass $remote_directory to _abort_operation - Added path to error payload, using either the passed path or pwd() as fallback This standardization ensures consistent error reporting across all transport implementations and makes debugging transport issues easier. Test plan: 1. Verify FTP transport operations still work correctly 2. Check that error messages now include the path that failed 3. Confirm no regressions in existing FTP functionality Signed-off-by: Martin Renvoize --- Koha/File/Transport/FTP.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Koha/File/Transport/FTP.pm b/Koha/File/Transport/FTP.pm index fd484a6623f..4c14744619b 100644 --- a/Koha/File/Transport/FTP.pm +++ b/Koha/File/Transport/FTP.pm @@ -166,7 +166,7 @@ sub _change_directory { my ( $self, $remote_directory ) = @_; my $operation = "change_directory"; - $self->{connection}->cwd($remote_directory) or return $self->_abort_operation($operation); + $self->{connection}->cwd($remote_directory) or return $self->_abort_operation( $operation, $remote_directory ); $self->add_message( { @@ -289,7 +289,7 @@ sub _is_connected { } sub _abort_operation { - my ( $self, $operation ) = @_; + my ( $self, $operation, $path ) = @_; $self->add_message( { @@ -297,7 +297,8 @@ sub _abort_operation { type => 'error', payload => { detail => $self->{connection} ? $self->{connection}->status : '', - error => $self->{connection} ? $self->{connection}->message : $@ + error => $self->{connection} ? $self->{connection}->message : $@, + path => $path ? $path : $self->{connection}->pwd, } } ); -- 2.51.0