8000 [AssetMapper] `MappedAssetFactory->isVendor()` return `true` when the directory is missing · Issue #58858 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alexislefebvre opened this issue Nov 13, 2024 · 0 comments · Fixed by #58859
Closed

Comments

@alexislefebvre
Copy link
Contributor
alexislefebvre commented Nov 13, 2024

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.

@alexislefebvre alexislefebvre changed the title MappedAssetFactory->isVendor() return true when the directory is missing [AssetMapper] MappedAssetFactory->isVendor() return true when the directory is missing Nov 13, 2024
smnandre added a commit to smnandre/symfony that referenced this issue Nov 14, 2024
Good catch in symfony#58858, we never check the %kernel_projectDir%/assets/vendors exists.
nicolas-grekas added a commit that referenced this issue Nov 20, 2024
…exislefebvre)

This PR was merged into the 6.4 branch.

Discussion
----------

[AssetMapper] ignore missing directory in `isVendor()`

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #58858
| License       | MIT

~~I don't know how to add tests yet, because this method is private.~~

Commits
-------

9e3984f fix: ignore missing directory in isVendor()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
0