Skip to content

[bug]: Filestore recursive listings. #1055

Description

@jfinstrom

FreePBX Version

FreePBX 17

Issue Description

Summary

Filestore does not appear to return files correctly from nested subdirectories when listing files from a parent local storage path.

Relates to: #1054

This affects Backup & Restore when a backup job uses Append Backup Name as a directory to the Storage path, because backups are written under:

<storage path>/<backup_name>/<backup-file>

but those files are not shown unless the Filestore path is changed to point directly at the generated <backup_name> subdirectory.

Steps to reproduce

  1. Create a Filestore local path pointing to a mounted path such as:
    • /mnt/backup
  2. Use that Filestore location in Backup & Restore as a storage target.
  3. Enable Append Backup Name as a directory to the Storage path.
  4. Run the backup.
  5. Confirm the backup file exists under:
    • /mnt/backup/<backup_name>/
  6. Attempt to browse or enumerate files through Filestore from the parent path /mnt/backup.

Actual behavior

Files inside the generated subdirectory are not returned/visible as expected from the parent Filestore path.

Expected behavior

If Filestore is asked to list files recursively from a parent path, it should return files contained in nested subdirectories such as:

/mnt/backup/<backup_name>/<backup-file>

Workaround

Point the Filestore path directly at the generated backup subdirectory, for example:

/mnt/backup/<backup_name>

When using that full path, the backup files become visible.

Notes

This appears related to recursive file listing in Filestore.class.php, specifically listAllFiles($subdir = true).

A change like the following appears relevant:

- // previous logic manually expanded directory contents
+ $recursiveResults = $this->ls($instance['id'], $instance['path'], true);
+ // then filter returned results to files

The issue may be that the current implementation does not fully or consistently return nested files when listing from the parent path.

Operating Environment

  • Latest Filestore 17

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageTriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions