Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[AssetMapper] Fixing bug where a circular exception could be thrown while making error message#51345

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@weaverryan
Copy link
Member

QA
Branch?6.3
Bug fix?yes
New feature?no
Deprecations?none
TicketsFix#51291
LicenseMIT
Doc PRNot needed

AssetMapper'sJavaScriptImportPathCompiler parses import statements. That process is imperfect and will over-match in some cases (e.g. matchingimport() that is commented-out). but that's not a huge issue: any matches are simply added to the importmap and matches for not-found-files are ignored.

However, in#51291, we hit a spot where, while trying to improve the log message (Try adding ".js" to the end of the import - i.e. "%s.js"), we triggered a circular exception. This PR suppresses that.

We may need to improve the parsing logic later to handle more edge-cases, but we'll handle those if/when they come up.

Cheers!

}
});

$asset =newMappedAsset('html.js','/path/to/app.js');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think there's a typo here, shouldn't it be'htmx.js'?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yup - it doesn't matter for the test, but definitely wasn't my intention. Fixing it - thanks :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Well, withhtml.js, the test would not trigger a circular error, and so would not prevent regressions. So it definitely matters.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

No - the circular reference is triggered a bit manually on the mock. So you're correct in a real-world example, but in this case, this part doesn't matter (creating a test that resulted in a natural, real-world circular reference was going to be a lot more work as we need a real AssetMapper, MappedAssetFactory, etc.

@nicolas-grekas
Copy link
Member

Thank you@weaverryan.

@nicolas-grekasnicolas-grekasforce-pushed theasset-mapper-avoid-circular-on-error branch froma9305a9 to63b9635CompareAugust 14, 2023 14:11
@nicolas-grekasnicolas-grekas merged commitaba725f intosymfony:6.3Aug 14, 2023
@weaverryanweaverryan deleted the asset-mapper-avoid-circular-on-error branchAugust 15, 2023 11:01
@fabpotfabpot mentioned this pull requestAug 26, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

+1 more reviewer

@mhitzamhitzamhitza left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.3

Development

Successfully merging this pull request may close these issues.

5 participants

@weaverryan@nicolas-grekas@mhitza@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp