Skip to content

Commit a9a080f

Browse files
authored
[11.x] Fixes out of memory issue running route:cache with ServeFile (#52781)
fixes #52779 Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 54cf9db commit a9a080f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Illuminate/Filesystem/FilesystemServiceProvider.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,18 @@ protected function serveFiles()
8888
continue;
8989
}
9090

91-
$this->app->booted(function () use ($disk, $config) {
91+
$this->app->booted(function ($app) use ($disk, $config) {
9292
$uri = isset($config['url'])
9393
? rtrim(parse_url($config['url'])['path'], '/')
9494
: '/storage';
9595

96-
Route::get($uri.'/{path}', function (Request $request, string $path) use ($disk, $config) {
96+
$isProduction = $app->isProduction();
97+
98+
Route::get($uri.'/{path}', function (Request $request, string $path) use ($disk, $config, $isProduction) {
9799
return (new ServeFile(
98100
$disk,
99101
$config,
100-
$this->app->isProduction()
102+
$isProduction
101103
))($request, $path);
102104
})->where('path', '.*')->name('storage.'.$disk);
103105
});

0 commit comments

Comments
 (0)