Skip to content

allDirectories() returns an empty arrayΒ #15

@lakkes-ra

Description

@lakkes-ra

Summary

Hi there!

I originally opened an issue over at the eloquent-driver for Statamic. While investigating a problem with empty asset folders disappearing after a cache clear, I was directed here as the issue may stem from this adapter.

The problem appears when calling Storage::disk('uploads')->allDirectories() on an Azure Blob Storage disk using this adapter. It always returns an empty array, even when folders (including nested ones with files) are definitely present in the blob container.

This differs from calling Storage::disk('uploads')->directories(), which correctly returns the top-level folders as expected. The issue only appears with allDirectories().

This behavior differs from local or S3 disks. On those disks, allDirectories() behaves as expected, recursively listing all folders.

In Azure, I confirmed via Tinker and Azure Storage Explorer that nested folders and files exist. Some folders even contain .gitkeep or .txt files, so they're not actually empty. Yet allDirectories() still returns an empty array.

The Laravel documentation says that allDirectories() should return all directories recursively, but it seems the Azure adapter may not be properly supporting this behavior.

Let me know if I can help provide additional context or test anything else. Thanks!

Versions

Version
PHP version 8.3.19
azure-storage-php-adapter-laravel version 1.3.0

Self-enclosed code snippet for reproduction

Storage::disk('uploads')->allDirectories()

Expected output

[
   'folder1'
   'folder2'
   'nested-folder'
   'etc'
]

Actual output

[]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions