diff --git a/src/Symfony/Component/AssetMapper/AssetMapperDevServerSubscriber.php b/src/Symfony/Component/AssetMapper/AssetMapperDevServerSubscriber.php index 9b82408814f47..5cdd9be73f7b6 100644 --- a/src/Symfony/Component/AssetMapper/AssetMapperDevServerSubscriber.php +++ b/src/Symfony/Component/AssetMapper/AssetMapperDevServerSubscriber.php @@ -117,7 +117,7 @@ public function onKernelRequest(RequestEvent $event): void return; } - $pathInfo = $event->getRequest()->getPathInfo(); + $pathInfo = rawurldecode($event->getRequest()->getPathInfo()); if (!str_starts_with($pathInfo, $this->publicPrefix)) { return; } diff --git a/src/Symfony/Component/AssetMapper/Tests/AssetMapperDevServerSubscriberFunctionalTest.php b/src/Symfony/Component/AssetMapper/Tests/AssetMapperDevServerSubscriberFunctionalTest.php index e8d52c3248b38..455d9f4fd452a 100644 --- a/src/Symfony/Component/AssetMapper/Tests/AssetMapperDevServerSubscriberFunctionalTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/AssetMapperDevServerSubscriberFunctionalTest.php @@ -32,6 +32,20 @@ public function testGettingAssetWorks() $this->assertSame('immutable, max-age=604800, public', $response->headers->get('Cache-Control')); } + public function testGettingAssetWithNonAsciiFilenameWorks() + { + $client = static::createClient(); + + $client->request('GET', '/assets/voilà-6344422da690fcc471f23f7a8966cd1c.css'); + $response = $client->getResponse(); + $this->assertSame(200, $response->getStatusCode()); + $this->assertSame(<<getContent()); + } + public function test404OnUnknownAsset() { $client = static::createClient(); diff --git a/src/Symfony/Component/AssetMapper/Tests/Command/AssetsMapperCompileCommandTest.php b/src/Symfony/Component/AssetMapper/Tests/Command/AssetsMapperCompileCommandTest.php index d78544cf9c888..c982566385435 100644 --- a/src/Symfony/Component/AssetMapper/Tests/Command/AssetsMapperCompileCommandTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/Command/AssetsMapperCompileCommandTest.php @@ -63,7 +63,7 @@ public function testAssetsAreCompiled() $finder = new Finder(); $finder->in($targetBuildDir)->files(); - $this->assertCount(10, $finder); + $this->assertCount(11, $finder); $this->assertFileExists($targetBuildDir.'/manifest.json'); $this->assertSame([ @@ -74,6 +74,7 @@ public function testAssetsAreCompiled() 'file4.js', 'subdir/file5.js', 'subdir/file6.js', + 'voilà.css', ], array_keys(json_decode(file_get_contents($targetBuildDir.'/manifest.json'), true))); $this->assertFileExists($targetBuildDir.'/importmap.json'); diff --git a/src/Symfony/Component/AssetMapper/Tests/fixtures/AssetMapperTestAppKernel.php b/src/Symfony/Component/AssetMapper/Tests/fixtures/AssetMapperTestAppKernel.php index 05a4272b0ed11..c3cf0fb252586 100644 --- a/src/Symfony/Component/AssetMapper/Tests/fixtures/AssetMapperTestAppKernel.php +++ b/src/Symfony/Component/AssetMapper/Tests/fixtures/AssetMapperTestAppKernel.php @@ -40,7 +40,7 @@ public function registerContainerConfiguration(LoaderInterface $loader): void 'http_client' => true, 'assets' => null, 'asset_mapper' => [ - 'paths' => ['dir1', 'dir2'], + 'paths' => ['dir1', 'dir2', 'non_ascii'], ], 'test' => true, ]); diff --git "a/src/Symfony/Component/AssetMapper/Tests/fixtures/non_ascii/voil\303\240.css" "b/src/Symfony/Component/AssetMapper/Tests/fixtures/non_ascii/voil\303\240.css" new file mode 100644 index 0000000000000..f9a66cb6613c8 --- /dev/null +++ "b/src/Symfony/Component/AssetMapper/Tests/fixtures/non_ascii/voil\303\240.css" @@ -0,0 +1,2 @@ +/* voilà.css */ +body {}