UniSharp / laravel-filemanager

Media gallery with CKEditor, TinyMCE and Summernote support. Built on Laravel file system.
https://unisharp.github.io/laravel-filemanager/
MIT License
2.09k stars 720 forks source link

AWS S3 responds with 500 on folders with a lot of files #1135

Open emyasnikov opened 2 years ago

emyasnikov commented 2 years ago

After upgrade from Laravel 8 to 9 and accordingly Flysystem 1.x to 3 filemanager doesn't work with folders with a lot of files since league/flysystem-cached-adapter packages can't be installed anymore.

[2022-05-04 13:08:15] local.ERROR: Unable to retrieve the last_modified for file at location: files/shares.  {"userId":1,"exception":"[object] (League\\Flysystem\\UnableToRetrieveMetadata(code: 0): Unable to retrieve the last_modified for file at location: files/shares.  at .../vendor/league/flysystem/src/UnableToRetrieveMetadata.php:49)

Please check the following instructions before submitting a bug :

And provide the followings :

Request URL: http://localhost.pim/laravel-filemanager/jsonitems?working_dir=&type=&sort_type=alphabetic&page=1&_=1651673105245
Request Method: GET
Status Code: 500 Internal Server Error
Remote Address: 127.0.0.1:80
Referrer Policy: strict-origin-when-cross-origin
jorenvh commented 2 years ago

I can confirm that this isn't working, running into the same issue after upgrading from Laravel 8 to Laravel 9

jorenvh commented 2 years ago

I looked into this issue a bit more and it seems that it only occurs with folders that contain subfolders. It seems like something has changed in the behavior of flystem that is causing this.

lildigiman commented 2 years ago

This appears to happen to me because lfm is trying to get the last_modified attribute of directories, which s3 doesn't provide.

My error as followed with a directory containing subfolders:

Unable to retrieve the last_modified for file at location:

It appears to be very similar to the issue noted over on flysystem's repository, however it has been closed as not compelling enough to resolve: https://github.com/thephpleague/flysystem/issues/1343

It seems that lfm would need to check if the item is a directory when filling the item_column attributes, and remove time from that list for directory items.

Possible Workaround: Remove time from item_columns in the lfm.php config file. This works for me.

hmawla commented 2 years ago

would be great if this gets solved soon

thanks

mrobbizulfikar commented 1 year ago

@lildigiman it worked well, but when I open the filemanager it shows 'Invalid date' under the name of each file. I know that removing time from item_columns will affect the filemanager. But anyone know how to solve it?