https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43078

            Bug ID: 43078
           Summary: File transport SFTP backend returns inconsistent
                    list() structure compared to FTP/Local backends
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
  Target Milestone: ---

The polymorphic file transport classes (FTP, SFTP, Local) are intended to
provide a consistent API across transport backends, wrapping existing CPAN
modules (Net::FTP, Net::SFTP::Foreign) alongside a local filesystem
implementation.

The list() method on the FTP and Local backends returns an array of flat
hashrefs, each containing file metadata (filename, size, modification time,
etc.).

The SFTP backend, however, returns metadata partially nested inside
Net::SFTP::Foreign::Attributes objects, as this is the native return structure
from Net::SFTP::Foreign. This means callers of list() currently need to know
which backend they're talking to in order to correctly extract file metadata,
which defeats the purpose of the shared API.

Steps to reproduce:
Instantiate the FTP or Local transport class and call list() on a directory
Instantiate the SFTP transport class and call list() on the same logical
directory
Compare the structure of returned metadata — SFTP results include nested
attribute objects; FTP/Local do not
Expected behaviour:
All three backends return metadata in the same flat hashref structure for a
given list() call.

Suggested fix:
Flatten the relevant fields out of Net::SFTP::Foreign::Attributes (size, mtime,
permissions, etc.) into the same flat hash shape used by the other two
backends, within the SFTP wrapper class.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to