fix(assets): allow 304 Not Modified status to bypass redirect check while revalidating cached assets#15935
Open
oliverlynch wants to merge 3 commits intowithastro:mainfrom
Open
fix(assets): allow 304 Not Modified status to bypass redirect check while revalidating cached assets#15935oliverlynch wants to merge 3 commits intowithastro:mainfrom
oliverlynch wants to merge 3 commits intowithastro:mainfrom
Conversation
- replace double awaits with Promise.all - explicitly return null data from revalidateRemoteImage when there is no change - explicitly write cache file in utf-8, as we are reading it in utf-8
🦋 Changeset detectedLatest commit: 27ff03d The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Fix bug #15920 introduced in 35bc814 by skipping the redirect check for Not Modified status 304
A few other small improvements
revalidateRemoteImagewhen there is no change - before this relied on the response body for unchanged assets being empty, and it was confusing.Testing
I ran
pnpm run test:match "assets"with 0 errors, however the fullpnpm run testfails on my machine.I don't believe there is any test coverage of the revalidation feature as it depends on remote servers, however I quickly tested the fix by loading a remote image and editing the cache file and it seems to work as expected.
Docs
No user facing changes - no docs changes required.