Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

arnaud-ritti
Copy link
Contributor

Has mentioned in issue #101 , integrity hash is missing into the link headers.

Update test case to be cohérent with the case
Copy link
Member

@weaverryan weaverryan left a 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!

@@ -91,7 +91,7 @@ public function renderWebpackScriptTags(string $entryName, string $packageName =
$this->convertArrayToAttributes($attributes)
);

$this->renderedFiles['scripts'][] = $attributes['src'];
$this->renderedFiles['scripts'][] = $attributes;
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link

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.

@mustanggb
Copy link

Needs a reroll.

@ToshY
Copy link

ToshY commented Feb 16, 2024

@weaverryan @jrushlow please take a look at this.

@ToshY
Copy link

ToshY commented Feb 23, 2024

@weaverryan @jrushlow please take a look at this.

1 similar comment
@ToshY
Copy link

ToshY commented Mar 3, 2024

@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"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
$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"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
$this->renderedFiles['styles'][] = $attributes["href"];
$this->renderedFiles['styles'][] = $attributes['href'];

@jrushlow jrushlow added the Status: Needs Work Additional work is needed label Mar 12, 2024
@ping-localhost
Copy link

Can you process the feedback @arnaud-ritti or would you like someone else to pick this up?

@ToshY
Copy link

ToshY commented Sep 30, 2024

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 December 10, 2020 (and this PR roughly a year later on January 12, 2022).

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?

@Kocal
Copy link
Member

Kocal commented Sep 30, 2024

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.

but the lack of communication and the delayed response times from the core maintainers is shockingly bad for Symfony standards.

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!

@ToshY
Copy link

ToshY commented Sep 30, 2024

Thank you for your response @Kocal .

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'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 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.

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.

@Kocal
Copy link
Member

Kocal commented Oct 1, 2024

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.
I'm gonna open a new PR (with @arnaud-ritti's commits), fix some things, and merge ASAP.

@Kocal Kocal changed the base branch from main to 2.x October 1, 2024 15:34
Kocal added a commit that referenced this pull request Oct 2, 2024
…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
@Kocal
Copy link
Member

Kocal commented Oct 2, 2024

@Kocal Kocal closed this Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix Status: Needs Work Additional work is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants