Closed initred closed 1 year ago
I suspect this is because the filename contains a period .
.
@zepfietje I removed the period (.) from the file and tried again, but there is still a problem. And I uploaded the file to the Reproduction repository.
I would appreciate it if you could reactivate this issue.
@initred can you test if it is working with plain Livewire upload? https://livewire.laravel.com/docs/uploads also test with filename: 마음의소리123.mp4
@wychoong I will test it and reply when I have time.
Yeah thanks for commenting, @wychoong. Would be great to know if this is a Filament or Livewire issue, @initred.
@wychoong @zepfietje
I tested different names on the same file with livewire.
마음의소리1회(가장의권위두개머리가몇개야)_(더빙판)NonDRM[HD] (편집본).mp4
The above files export the logs below.
[2023-10-06 16:38:39] local.ERROR: League\Flysystem\Filesystem::write(): Argument #2 ($contents) must be of type string, null given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 375 {"exception":"[object] (TypeError(code: 0): League\\Flysystem\\Filesystem::write(): Argument #2 ($contents) must be of type string, null given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 375 at /var/www/html/vendor/league/flysystem/src/Filesystem.php:52)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(375): League\\Flysystem\\Filesystem->write()
#1 /var/www/html/vendor/livewire/livewire/src/Features/SupportFileUploads/TemporaryUploadedFile.php(143): Illuminate\\Filesystem\\FilesystemAdapter->put()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php(36): Livewire\\Features\\SupportFileUploads\\TemporaryUploadedFile->storeAs()
#3 /var/www/html/app/Livewire/MovieUpload.php(23): Illuminate\\Http\\UploadedFile->store()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Livewire\\MovieUpload->saveMovie()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#8 /var/www/html/vendor/livewire/livewire/src/Wrapped.php(23): Illuminate\\Container\\BoundMethod::call()
#9 /var/www/html/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(465): Livewire\\Wrapped->__call()
#10 /var/www/html/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(108): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->callMethods()
#11 /var/www/html/vendor/livewire/livewire/src/LivewireManager.php(96): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->update()
#12 /var/www/html/vendor/livewire/volt/src/LivewireManager.php(34): Livewire\\LivewireManager->update()
#13 /var/www/html/vendor/livewire/livewire/src/Mechanisms/HandleRequests/HandleRequests.php(85): Livewire\\Volt\\LivewireManager->update()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(46): Livewire\\Mechanisms\\HandleRequests\\HandleRequests->handleUpdate()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\\Routing\\Route->runController()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(799): Illuminate\\Routing\\Route->run()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(798): Illuminate\\Pipeline\\Pipeline->then()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(777): Illuminate\\Routing\\Router->runRouteWithinStack()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(741): Illuminate\\Routing\\Router->runRoute()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(730): Illuminate\\Routing\\Router->dispatchToRoute()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#39 /var/www/html/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#43 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(36): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#47 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#48 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#49 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#50 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle()
#51 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#52 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#53 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#54 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
#55 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#56 /var/www/html/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle()
#57 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(16): require_once('...')
#58 {main}
"}
Reproduction repository has been updated.
So this isn't a Filament issue actually?
ok, so i did a little source dive, it is a livewire issue and sad to say it might not be fixed able due to how it works internally
so the issue is when uploading a file, livewire will base64_encode the filename and it becomes extremely long (multibyte maybe?), so filesystem failed to store, and weirdly it silently failed https://github.com/livewire/livewire/blob/b25402aff4911dbccae5583308e94af4c9681ebb/src/Features/SupportFileUploads/TemporaryUploadedFile.php#L150-L157
usually max limit 255 chars https://serverfault.com/questions/9546/filename-length-limits-on-linux and this sample file after base64 it becomes 270+ before lw's format in name. you can verify by shorten the korean filename and try again
there is a closed but not fixed issue https://github.com/livewire/livewire/issues/2834 @initred i think you should submit a failing test there
@wychoong @zepfietje
Thank you always for your hard work.
I think this problem must be solved. Clients don't care about file names.
I will try to register again with the livewire issue. You must be busy, but thank you for taking the time to answer. 👍
Package
filament/forms
Package Version
v3.0.63
Laravel Version
v10.25.2
Livewire Version
No response
PHP Version
8.2
Problem description
Hello, I enjoy laravel in Korea, and I am currently using filament to build a manager site.
I don't know why, but some video file names including Korean language are not uploaded.
If you rename the file to English and upload it with the special symbols in question, the function of uploading the file works normally.
Expected behavior
Files must be uploaded normally, regardless of language or file name length.
Steps to reproduce
I'll list some file names that have raised issues.
Reproduction repository
https://github.com/initred/filamentphp-korean-lang-video-upload-issue
Relevant log output