Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 79e49d8

Browse filesBrowse files
committed
Fix exception if assets dir is missing in prod
1 parent 6f21d07 commit 79e49d8
Copy full SHA for 79e49d8

File tree

Expand file treeCollapse file tree

4 files changed

+9
-2
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+9
-2
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,11 +1348,13 @@ private function registerAssetMapperConfiguration(array $config, ContainerBuilde
13481348
foreach ($config['excluded_patterns'] as $path) {
13491349
$excludedPathPatterns[] = Glob::toRegex($path, true, false);
13501350
}
1351+
$strictMode = $container->getParameter('kernel.debug');
13511352

13521353
$container->getDefinition('asset_mapper.repository')
13531354
->setArgument(0, $paths)
13541355
->setArgument(2, $excludedPathPatterns)
1355-
->setArgument(3, $config['exclude_dotfiles']);
1356+
->setArgument(3, $config['exclude_dotfiles'])
1357+
->setArgument(4, $strictMode);
13561358

13571359
$container->getDefinition('asset_mapper.public_assets_path_resolver')
13581360
->setArgument(0, $config['public_prefix']);

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/asset_mapper.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/asset_mapper.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
param('kernel.project_dir'),
7676
abstract_arg('array of excluded path patterns'),
7777
abstract_arg('exclude dot files'),
78+
abstract_arg('strict mode'),
7879
])
7980

8081
->set('asset_mapper.public_assets_path_resolver', PublicAssetsPathResolver::class)

‎src/Symfony/Component/AssetMapper/AssetMapperRepository.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/AssetMapperRepository.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function __construct(
3434
private readonly string $projectRootDir,
3535
private readonly array $excludedPathPatterns = [],
3636
private readonly bool $excludeDotFiles = true,
37+
private readonly bool $strictMode = false
3738
) {
3839
}
3940

@@ -161,7 +162,9 @@ private function getDirectories(): array
161162
continue;
162163
}
163164

164-
throw new \InvalidArgumentException(sprintf('The asset mapper directory "%s" does not exist.', $path));
165+
if ($this->strictMode) {
166+
throw new \InvalidArgumentException(sprintf('The asset mapper directory "%s" does not exist.', $path));
167+
}
165168
}
166169

167170
return $this->absolutePaths;

‎src/Symfony/Component/AssetMapper/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/AssetMapper/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CHANGELOG
1818
* Add a `importmap:audit` command to check for security vulnerability advisories in dependencies
1919
* Add a `importmap:outdated` command to check for outdated packages
2020
* Change the polyfill used for the importmap renderer from a URL to an entry in the importmap
21+
* Fix exception if assets directory is missing in production environment
2122

2223
6.3
2324
---

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.