Skip to content

fix(@angular/build): avoid internal karma request cache for assets #30227

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

Merged
merged 1 commit into from
May 2, 2025

Conversation

clydin
Copy link
Member

@clydin clydin commented May 1, 2025

The internal karma common middleware that handles requests converts the to be cached data into a string when stored. This can lead to invalid data when the cached string is then sent in a followup request if the original content was not intended to be a string. To avoid this problem, asset files are now explicitly not cached by karma's middleware.
Ref: https://github.com/karma-runner/karma/blob/84f85e7016efc2266fa6b3465f494a3fa151c85c/lib/middleware/common.js#L72

Closes #30198

@clydin clydin force-pushed the karma/binary-assets branch 3 times, most recently from f7aee32 to c5068a2 Compare May 2, 2025 18:07
@clydin clydin marked this pull request as ready for review May 2, 2025 18:07
@clydin clydin linked an issue May 2, 2025 that may be closed by this pull request
1 task
@clydin clydin added target: patch This PR is targeted for the next patch release action: review The PR is still awaiting reviews from at least one requested reviewer labels May 2, 2025
The internal karma common middleware that handles requests converts
the to be cached data into a string when stored. This can lead to invalid data
when the cached string is then sent in a followup request if the original content
was not intended to be a string. To avoid this  problem, asset files are now
explicitly not cached by karma's middleware.
Ref: https://github.com/karma-runner/karma/blob/84f85e7016efc2266fa6b3465f494a3fa151c85c/lib/middleware/common.js#L72
@clydin clydin force-pushed the karma/binary-assets branch from c5068a2 to facfe87 Compare May 2, 2025 18:26
@jkrems jkrems added action: merge The PR is ready for merge by the caretaker target: rc This PR is targeted for the next release-candidate and removed action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels May 2, 2025
@jkrems
Copy link
Contributor

jkrems commented May 2, 2025

Switching target to rc since it didn't land cleanly on the v19 branch.

@jkrems jkrems merged commit 90d1db3 into angular:main May 2, 2025
32 checks passed
@jkrems
Copy link
Contributor

jkrems commented May 2, 2025

The changes were merged into the following branches: main, 20.0.x

@clydin clydin deleted the karma/binary-assets branch May 2, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: @angular/build target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit tests using esbuild + Vite fail when reloading using Sqlite wasm
2 participants