-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Bug description
The v4.25.1 update ensures that empty folders are included in the asset browser by building the directory list from the database and then merging that with $container->disk()->getFolders():
eloquent-driver/src/Assets/AssetContainerContents.php
Lines 50 to 55 in b446044
| ->merge( | |
| collect($this->container->disk()->getFolders('/', true) | |
| ->filter(fn ($folder) => ! Str::startsWith($folder, '.')) | |
| ) | |
| ->map(fn ($folder) => ['path' => $folder, 'type' => 'dir']) | |
| ) |
getFolders calls $filesystem->allDirectories()
https://github.com/statamic/cms/blob/5.x/src/Filesystem/FlysystemAdapter.php#L66-L73
This translates to listContents(path: '', recursive: true) in Flysystem. For large S3 buckets a call to list all directories recursively like this will time out and in some cases even crash PHP. The asset browser will spin until the request fails and then fall back to an empty state which makes the asset screen and asset fieldtype unusable.
Downgrading to v4.25.0 fixes the issue.
How to reproduce
I assume you would need a large S3 bucket with thousands of directories and images. The bucket I'm working with 90 GB and has 478k items.
Logs
Environment
Environment
Application Name: Statamic
Laravel Version: 12.19.3
PHP Version: 8.3.22
Composer Version: 2.8.9
Environment: local
Debug Mode: ENABLED
URL: statamic.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED
Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: log
Queue: sync
Session: file
Storage
public/storage: NOT LINKED
Statamic
Addons: 3
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.58.1 PRO
Statamic Addons
statamic-rad-pack/meilisearch: 3.4.0
statamic-rad-pack/runway: 8.5.1
statamic/eloquent-driver: 4.25.1
Statamic Eloquent Driver
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: file
Collections: file
Entries: file
Forms: file
Global Sets: file
Global Variables: file
Navigation Trees: file
Navigations: file
Revisions: eloquent
Sites: file
Taxonomies: file
Terms: eloquent
Tokens: fileAdditional details
No response