Skip to content

Commit 1f41d67

Browse files
committed
[AssetMapper] Only download a CSS file if it is explicitly advertised
1 parent 5aaa534 commit 1f41d67

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Symfony/Component/AssetMapper/ImportMap/Resolver/JsDelivrEsmResolver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ public function resolvePackages(array $packagesToRequire): array
129129

130130
$entrypoints = $cssEntrypointResponse->toArray()['entrypoints'] ?? [];
131131
$cssFile = $entrypoints['css']['file'] ?? null;
132+
$guessed = $entrypoints['css']['guessed'] ?? true;
132133

133-
if (!$cssFile) {
134+
if (!$cssFile || $guessed) {
134135
continue;
135136
}
136137

src/Symfony/Component/AssetMapper/Tests/ImportMap/Resolver/JsDelivrEsmResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public static function provideResolvePackagesTests(): iterable
224224
[
225225
'url' => '/v1/packages/npm/[email protected]/entrypoints',
226226
'response' => ['body' => ['entrypoints' => [
227-
'css' => ['file' => '/dist/css/bootstrap.min.css'],
227+
'css' => ['file' => '/dist/css/bootstrap.min.css', 'guessed' => false],
228228
]]],
229229
],
230230
[

0 commit comments

Comments
 (0)