Skip to content

[release/10.0] Write gzip footer for resource-collection.js.gz - #66647

Merged
lewing merged 1 commit into
dotnet:release/10.0from
akoeplinger:backport/66242-to-10.0
May 11, 2026
Merged

[release/10.0] Write gzip footer for resource-collection.js.gz#66647
lewing merged 1 commit into
dotnet:release/10.0from
akoeplinger:backport/66242-to-10.0

Conversation

@akoeplinger

@akoeplinger akoeplinger commented May 11, 2026

Copy link
Copy Markdown
Member

Backport of #66242 to release/10.0

Description

The generated resource-collection.js.gz payload was read before GZipStream disposal completed, so the gzip footer was omitted and some clients/tools rejected the response as truncated.

Update CreateGzipBytes to dispose GZipStream before reading the underlying MemoryStream. This ensures the final gzip trailer is written before the endpoint caches and serves the compressed bytes.

Fixes #66218

Customer Impact

Some clients/tools rejected the response as truncated. See #66218

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

Risk

  • High
  • Medium
  • Low

We're just ensuring the gzip trailer is correctly written as expected.

Verification

  • Manual (required)
  • Automated

Added unit test.

Packaging changes reviewed?

  • Yes
  • No
  • N/A

Backport of dotnet#66242

The GZipStream must be fully disposed (not just flushed) before reading
the underlying MemoryStream, otherwise the gzip footer is missing and
the output is an incomplete gzip payload. Use a using block to ensure
proper disposal.

Added test to verify the gzip endpoint returns a complete, decompressible
payload matching the uncompressed content endpoint.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 16:38
@akoeplinger
akoeplinger requested a review from a team as a code owner May 11, 2026 16:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Backports a fix to ensure the generated resource-collection.js.gz payload is a valid, complete gzip stream by guaranteeing the gzip trailer/footer is written before the bytes are cached and served.

Changes:

  • Dispose GZipStream before reading the underlying MemoryStream to ensure the gzip footer is written.
  • Add an endpoint test that requests the .js.gz endpoint, decompresses the response, and verifies it matches the uncompressed .js payload.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Components/Endpoints/src/Builder/ResourceCollectionUrlEndpoint.cs Fixes gzip byte generation by disposing GZipStream before calling ToArray().
src/Components/Endpoints/test/Builder/ResourceCollectionUrlEndpointTest.cs Adds coverage validating the .js.gz endpoint produces a decompressible payload matching the uncompressed endpoint.

@lewing lewing added the Servicing-consider Shiproom approval is required for the issue label May 11, 2026
@lewing lewing added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels May 11, 2026
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label May 11, 2026
@lewing
lewing merged commit d34d7e4 into dotnet:release/10.0 May 11, 2026
32 checks passed
@dotnet-policy-service dotnet-policy-service Bot added this to the 10.0.9 milestone May 11, 2026
@akoeplinger
akoeplinger deleted the backport/66242-to-10.0 branch May 12, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants