Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media library's one of the folders is not loading #5832

Open
aumarov opened this issue Jan 7, 2024 · 3 comments
Open

media library's one of the folders is not loading #5832

aumarov opened this issue Jan 7, 2024 · 3 comments

Comments

@aumarov
Copy link

aumarov commented Jan 7, 2024

Laravel version

10.39

PHP version

8.2

Voyager version

1.7

Database

10.11.4 MariaDB

Description

Hi,
I upgraded both Laravel and Voyager. Laravel from 7 to 10 and Voyager from 1.5 to 1.7. The website is working, media library symlink in place.

When I open Media Libray in admin, it shows several folders. I can enter all folders, except one (which has folders and images), which I actively use and has almost 2.9 GB images. When I click on this folder, it is just shows loading animation. Before the update, the folder was opening without any problems.

The folder size could be problem, but is there any solution for this?

Steps to reproduce

Log shows this error

Undefined array key "extension" {"userId":8,"exception":"[object] (ErrorException(code: 0): Undefined array key "extension\ at vendor/tcg/voyager/src/Http/Controllers/VoyagerMediaController.php:89)

89 line is:
filename' => $item['filename'] ?? basename($item['path'], '.'.pathinfo($item['path'])['extension']),

Expected behavior

I expect folder to open and files are uploaded.

Screenshots

eeee

Additional context

no additional context

@aumarov
Copy link
Author

aumarov commented Jan 7, 2024

This error appears only when I am trying to open folder, which is not loading. No errors, when I am opening other folders.

Full error

Undefined array key "extension" {"userId":8,"exception":"[object] (ErrorException(code: 0): Undefined array key "extension" at vendor/tcg/voyager/src/Http/Controllers/VoyagerMediaController.php:89)
error local 2024-01-07 06:30:57 Undefined array key "extension" {"userId":8,"exception":"[object] (ErrorException(code: 0): Undefined array key "extension" at vendor/tcg/voyager/src/Http/Controllers/VoyagerMediaController.php:89)
[stacktrace]
#0 vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 vendor/tcg/voyager/src/Http/Controllers/VoyagerMediaController.php(89): Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()
#2 vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): TCG\Voyager\Http\Controllers\VoyagerMediaController->files()
#3 vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\Routing\Controller->callAction()
#4 vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\Routing\ControllerDispatcher->dispatch()
#5 vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\Routing\Route->runController()
#6 vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\Routing\Route->run()
#7 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#8 vendor/tcg/voyager/src/Http/Middleware/VoyagerAdminMiddleware.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#9 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): TCG\Voyager\Http\Middleware\VoyagerAdminMiddleware->handle()
#10 vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#11 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#12 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#13 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#14 vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#15 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#16 vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#17 vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()
#18 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Session\Middleware\StartSession->handle()
#19 vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#20 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#21 vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#22 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#23 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#24 vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\Pipeline\Pipeline->then()
#25 vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\Routing\Router->runRouteWithinStack()
#26 vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\Routing\Router->runRoute()
#27 vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\Routing\Router->dispatchToRoute()
#28 vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\Routing\Router->dispatch()
#29 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#30 vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#31 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Http\Middleware\TrustProxies->handle()
#32 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#33 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#34 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#35 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#36 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#37 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#38 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#39 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#40 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#41 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#42 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#43 vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then()
#44 vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#45 /home/admin/web/uzdaily.uz/public_html/index.php(104): Illuminate\Foundation\Http\Kernel->handle()
#46 {main}
"}

@Emerica
Copy link
Contributor

Emerica commented Jan 7, 2024

While this is probably a bug. Empty nick probably wasn't expecting pathinfo() not to return keys on missing file extentions.
If you have a look through that folder, are there any files missing a file extension?

image

'filename' => $item['filename'] ?? basename($item['path'], '.'.pathinfo($item['path'])['extension']),

There needs to be a check for the existence of the extension key here before it's used.
Your quick fix is to find the file creating the issues and move or rename it.

@aumarov
Copy link
Author

aumarov commented Jan 7, 2024

While this is probably a bug. Empty nick probably wasn't expecting pathinfo() not to return keys on missing file extentions. If you have a look through that folder, are there any files missing a file extension?

image

'filename' => $item['filename'] ?? basename($item['path'], '.'.pathinfo($item['path'])['extension']),

There needs to be a check for the existence of the extension key here before it's used. Your quick fix is to find the file creating the issues and move or rename it.

This was helpful. Indeed there was one file without any extention. I deleted it and it is opening in admin. Thank you for your helo.

Emerica added a commit to Emerica/voyager that referenced this issue Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants