Skip to content

Write gzip footer for resource-collection.js.gz#66242

Merged
javiercn merged 1 commit intomainfrom
copilot/fix-gzip-footer-issue
Apr 9, 2026
Merged

Write gzip footer for resource-collection.js.gz#66242
javiercn merged 1 commit intomainfrom
copilot/fix-gzip-footer-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 9, 2026

Write gzip footer for resource-collection.js.gz

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Ensure resource-collection gzip payloads include the footer

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.

  • Runtime fix

    • 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.
  • Coverage

    • Add a focused endpoint test that exercises the generated .js.gz route.
    • Verify the response decompresses successfully and matches the uncompressed resource-collection.js payload.
private static byte[] CreateGzipBytes(byte[] bytes)
{
    using var gzipContent = new MemoryStream();
    using (var gzipStream = new GZipStream(gzipContent, CompressionLevel.Optimal, leaveOpen: true))
    {
        gzipStream.Write(bytes);
    }

    return gzipContent.ToArray();
}

Copilot AI linked an issue Apr 9, 2026 that may be closed by this pull request
1 task
Copilot AI changed the title [WIP] Fix missing GZIP footer in resource-collection.x.js Write gzip footer for resource-collection.js.gz Apr 9, 2026
Copilot AI requested a review from javiercn April 9, 2026 08:02
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Apr 9, 2026
@javiercn javiercn marked this pull request as ready for review April 9, 2026 08:20
@javiercn javiercn requested a review from a team as a code owner April 9, 2026 08:20
Copilot AI review requested due to automatic review settings April 9, 2026 08:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes generation of resource-collection.js.gz so the gzip trailer/footer is included before the payload is cached and served, preventing clients/tools from treating the response as truncated.

Changes:

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

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Components/Endpoints/src/Builder/ResourceCollectionUrlEndpoint.cs Ensures gzip bytes are materialized only after GZipStream disposal so the trailer is present.
src/Components/Endpoints/test/Builder/ResourceCollectionUrlEndpointTest.cs Adds coverage validating the .js.gz response fully decompresses and matches the uncompressed payload.

Agent-Logs-Url: https://github.com/dotnet/aspnetcore/sessions/b7b5acc8-c8fb-438d-bbe5-6bd57c3eff13

Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
@javiercn javiercn force-pushed the copilot/fix-gzip-footer-issue branch from c8bcf80 to 0ebb21c Compare April 9, 2026 10:46
@javiercn javiercn merged commit 094a982 into main Apr 9, 2026
25 checks passed
@javiercn javiercn deleted the copilot/fix-gzip-footer-issue branch April 9, 2026 16:38
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview4 milestone Apr 9, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resource-collection.xxxx.js gzip footer not passed

4 participants