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 tags #237

Merged
merged 3 commits into from
Oct 2, 2024

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Oct 1, 2024

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:
image

@Kocal Kocal changed the title Fix missing integrity hash on preload Fix missing integrity hash on preload tags Oct 1, 2024
@Kocal Kocal force-pushed the fix/integrity-hash-preload branch from f5b5c97 to d682c35 Compare October 1, 2024 21:00
@Kocal Kocal force-pushed the fix/integrity-hash-preload branch from d682c35 to b8219a8 Compare October 1, 2024 21:04
@Kocal Kocal marked this pull request as ready for review October 1, 2024 21:04
@Kocal Kocal added the Bug Bug Fix label Oct 1, 2024
Kocal added a commit to symfony/webpack-encore that referenced this pull request Oct 2, 2024
…names with a query-string (Kocal)

This PR was merged into the main branch.

Discussion
----------

Fix issue between `Encore.enableIntegrityHashes()` and filenames with a query-string

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no <!-- please update CHANGELOG.md file -->
| Deprecations? | no <!-- please update CHANGELOG.md file -->
| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License       | MIT

<!--
Replace this notice by a description of your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - Features and deprecations must be submitted against the latest branch.
 - For new features, provide some code snippets to help understand usage.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility.
-->

When working on symfony/webpack-encore-bundle#237, I haven't able to see integrity hashes added on `<link>` tags, because my project uses query-string in generated filenames, but the bundle was not able to get those integrity hashes (because the `entrypoints.json` file contained  `"/build/sentry.js": "sha384-hash"` instead of `"/build/sentry.js?v=b86ff72e": "sha384-hash"`)

Commits
-------

c965684 Fix integrity hashes with query string, use the original assets name in "integrity" map
@Kocal
Copy link
Member Author

Kocal commented Oct 2, 2024

Thank you @arnaud-ritti.

@Kocal Kocal merged commit e335394 into symfony:2.x Oct 2, 2024
9 checks passed
@Kocal Kocal deleted the fix/integrity-hash-preload branch October 2, 2024 07:29
@mustanggb
Copy link

Hurray! 🎉

@Mecanik
Copy link

Mecanik commented Nov 14, 2024

Even with this latest version, I`m not getting any hashes added, anywhere. Of course .enableIntegrityHashes(Encore.isProduction()) is defined. Can you share your HTML definition?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix
Projects
None yet
4 participants