Repository navigation
fix(serve-static): respect q-values in Accept-Encoding for precompressed files - #5436
Merged
yusukebe merged 1 commit intoOct 16, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5436 +/- ##
==========================================
- Coverage 80.05% 79.34% -0.71%
==========================================
Files 156 156
Lines 11094 11199 +105
Branches 2377 2378 +1
==========================================
+ Hits 8881 8886 +5
- Misses 2213 2313 +100 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
Nice fix. Thanks. |
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.
With
precompressed: true,serveStaticsplitsAccept-Encodingon commas and compares the raw tokens. An encoding sent with a q-value, such asgzip;q=1.0, never matches, so the uncompressed file is served even when a precompressed one exists.This parses the header with
parseAccept, as the compress middleware does, and skips encodings rejected withq=0. The preference order (br > zstd > gzip) is unchanged.The author should do the following, if applicable
pnpm run format:fix && pnpm run lint:fixto format the code