-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Fix missing integrity hash on preload #161
Conversation
Update test case to be cohérent with the case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow review! Thanks for this - there is just one minor backwards-compatibility concern we need to address!
src/Asset/TagRenderer.php
Outdated
@@ -91,7 +91,7 @@ public function renderWebpackScriptTags(string $entryName, string $packageName = | |||
$this->convertArrayToAttributes($attributes) | |||
); | |||
|
|||
$this->renderedFiles['scripts'][] = $attributes['src']; | |||
$this->renderedFiles['scripts'][] = $attributes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this is a BC break, as it changes the structure of what's returned from getRenderedScripts()
and getRenderedStyles()
.
Probably we need to add and maintain a second property - e.g. $this->renderedFilesWithAttributes()
. Then, in getRenderedScripts()
(and also for styles), we could add a new bool $includeAttributes = false
argument. If that's true, then we return the renderedFilesWithAttributes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @weaverryan , Sorry for the delay. Thanks for your comment.
I fixed the BC break according your recommendations, if you want to check again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weaverryan @jrushlow This PR has been open for almost 2 years now, could either one spare some time to review it further and merge it? Thanks in advance.
Needs a reroll. |
@weaverryan @jrushlow please take a look at this. |
@weaverryan @jrushlow please take a look at this. |
1 similar comment
@weaverryan @jrushlow please take a look at this. |
@@ -91,13 +92,14 @@ public function renderWebpackScriptTags(string $entryName, string $packageName = | |||
$this->convertArrayToAttributes($attributes) | |||
); | |||
|
|||
$this->renderedFiles['scripts'][] = $attributes['src']; | |||
$this->renderedFiles['scripts'][] = $attributes["src"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->renderedFiles['scripts'][] = $attributes["src"]; | |
$this->renderedFiles['scripts'][] = $attributes['src']; |
@@ -129,7 +131,8 @@ public function renderWebpackLinkTags(string $entryName, string $packageName = n | |||
$this->convertArrayToAttributes($attributes) | |||
); | |||
|
|||
$this->renderedFiles['styles'][] = $attributes['href']; | |||
$this->renderedFiles['styles'][] = $attributes["href"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->renderedFiles['styles'][] = $attributes["href"]; | |
$this->renderedFiles['styles'][] = $attributes['href']; |
Can you process the feedback @arnaud-ritti or would you like someone else to pick this up? |
Multiple other users have already reported this bug (in #101 , #210 , #220, #225) and others also offered to fix it, but the lack of communication and the delayed response times from the core maintainers is shockingly bad for Symfony standards. And while I fully understand that this is not something Ryan should have to worry about (regarding his health), it does not take away that the original issue #101 was created on We are now nearing the end of 2024 and I have a feeling that this will not get merged for another 4 years at this rate. Is there not a(nother) core maintainer that can take responsibility for this bundle and make sure that atleast bugfixes still have a chance of getting merged? |
Hi @ToshY, thanks for pointing this out. Yes, things have slowed down a lot if not almost stopped, for the reasons you mentioned, but also for the time invested on the Symfony AssetMapper component. Note, this has also affected Webpack Encore.
I know it can be frustrating, but maybe that Webpack isn't their priority, and above all, whether it's Symfony or not, at the end of the day it's still open-source and nobody owes you anything. That said, I've been able to merge and create releases for a few weeks now. I'll do my best to handle the existing pull-requests, including this one! Cheers! |
Thank you for your response @Kocal .
I'm somewhat (positively) surprised that Webpack Encore (in this case you) has made some updates in the last couple of days. That's encouraging to see.
I am aware of that fact. It's just disappointing that this issue could have been resolved years ago if there was better communication and a more pro-active approach in merging open PRs. |
Unfortunately the checkbox "Allow edits and access to secrets by maintainers" is not checked, so I won't be able to push on this PR. |
…cal) This PR was merged into the 2.x branch. Discussion ---------- Fix missing integrity hash on preload tags I wasn't able to edit #161, so I've opened a new PR and made changes here. Fix #101, fix #225 On an existing app, integrity hashes and other attributes are nicely injected into `Link` header: <img width="1101" alt="image" src="https://github.com/user-attachments/assets/3733d80f-1927-49d9-8f0e-c8e340f7ed69"> Commits ------- b8219a8 Pass all attributes to `Link` header 707cd49 style: php-cs-fixer 2025c41 Fix missing integrity hash on preload
Has mentioned in issue #101 , integrity hash is missing into the link headers.