Fix use of Storage::url() for local disks that haven't been configured correctly. Fixes #4581

This commit is contained in:
Luke Towers 2019-09-02 12:33:36 -06:00
parent 1f47846832
commit 02d894f52b
2 changed files with 8 additions and 0 deletions

View File

@ -46,6 +46,7 @@ return [
'local' => [ 'local' => [
'driver' => 'local', 'driver' => 'local',
'root' => storage_path('app'), 'root' => storage_path('app'),
'url' => '/storage/app',
], ],
's3' => [ 's3' => [

View File

@ -88,6 +88,13 @@ class ServiceProvider extends ModuleServiceProvider
Schema::defaultStringLength(191); Schema::defaultStringLength(191);
} }
// Fix use of Storage::url() for local disks that haven't been configured correctly
foreach (Config::get('filesystems.disks') as $key => $config) {
if ($config['driver'] === 'local' && ends_with($config['root'], '/storage/app') && empty($config['url'])) {
Config::set("filesystems.disks.$key.url", '/storage/app');
}
}
Paginator::defaultSimpleView('system::pagination.simple-default'); Paginator::defaultSimpleView('system::pagination.simple-default');
/* /*