Skip to content

[AssetMapper] MappedAssetFactory->isVendor() return true when the directory is missing #58858

@alexislefebvre

Description

@alexislefebvre

Symfony version(s) affected

6.4

Description

MappedAssetFactory->isVendor() return true when the directory is missing, which leads to unexpected behaviours.

For some reason, str_starts_with('/app/assets/javascript/site_chart.js', null) returns true, so AssetMapper thinks that one file is in the vendor/ directory when it is not.

3v4l: https://3v4l.org/iZfv4

How to reproduce

Try to use https://github.com/sensiolabs/minify-bundle while the directory assets/vendor doesn't exist: sensiolabs/minify-bundle#17 (comment)

Possible Solution

Refactor isVendor() to handle this case.

Additional Context

I don't know yet if assets/vendor/ should or must be created by some automation (bin/console assets:install, bin/console asset-map:compile, or Symfony's recipes?) , but assets/vendor/ is added to .gitignore by the recipes: https://github.com/symfony/recipes/blob/21ffab22d3d8641e626b52bbabc435b690dde218/symfony/asset-mapper/6.4/manifest.json#L10 so it looks like it's possible to miss this directory.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions