Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug] Decompression leaves metadata that makes recompression throw and corrupt the content type

Open Beginner friendly
#4,683 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp

Research direction

Start with CompressPayloadTransformer.Unwrap, UnwrapAsync, Wrap, and WrapAsync; the issue identifies these methods and the duplicate originalContentType metadata as the failure. Reproduce with a non-empty body above the compression threshold and cover sync, async, and mixed calls. Done when recompressing after decompression succeeds and a failed wrap preserves the restored body and content type.

Written by the indexing model from the issue text.

Description

At c4e128c4f09c068e930a8165cb37f3880840edbe, CompressPayloadTransformer.Unwrap and UnwrapAsync restore the original ContentType and body but leave Bag["originalContentType"] behind. Wrap and WrapAsync add that key with Dictionary.Add.

A valid Wrap -> Unwrap -> Wrap sequence on the same message therefore throws ArgumentException for the duplicate key on the second compression. This affects forwarding or recompressing a message after inspection. The second Wrap also changes Header.ContentType before throwing, leaving an inconsistent message with an uncompressed body and compressed content type.

Verification: both unwrap methods were checked for cleanup, and both wrap methods use Add after assigning ContentType. No runtime execution is claimed. Reproduce with a non-empty body above the compression threshold: wrap with GZip, unwrap, then wrap again. The first round trip succeeds; the second wrap fails. Cover sync, async and mixed calls.

Expected: successful decompression should consume its compression bookkeeping header, or wrapping should safely replace metadata with a clearly defined ownership policy. Preserve the restored body and content type if wrapping fails.

Existing searches for compression original content type and CompressPayloadTransformer header found only unrelated completed #4432 (charset recognition).

Dominant language
C#
Stars
2.5k
Forks
301
Avg merge
1d 2h
Merged PRs (30d)
89

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BrighterCommand/Brighter

All issues in BrighterCommand/Brighter

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.