Bug 40811 - Enhance Koha::File::Transport API
Summary: Enhance Koha::File::Transport API
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 38115
Blocks:
  Show dependency treegraph
 
Reported: 2025-09-15 15:22 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2025-09-15 23:11 UTC (History)
4 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi (tcohen) 2025-09-15 15:22:37 UTC
Looking at bug 38115, it feels like the code that is required to use a transport is too protocol dependent.

The current sequence is:

1) Initialize the transport (->find)
2) Attempt to connect
3) Retrieve the configured base path ($file_server->upload_diectory)
4) Manually set the working dir for uploading $file_server->change_directory)
5) Upload the file

I believe we should (keeping only this FTP/SFTP use case in mind) simplify to:

1) Initialize (->find)
2) Upload the file with an optional path parameter

Step (2) would attempt to connect if the connection is not active, set the path to the passed path or internally pick the default and use it. Any failed step should raise a specific exception.

This schema could work for other protocols like S3, etc.