Remove custom compressor wrappers when replacing or disabling compression - #849
Closed
OskarEichler wants to merge 1 commit into
Closed
Remove custom compressor wrappers when replacing or disabling compression#849OskarEichler wants to merge 1 commit into
OskarEichler wants to merge 1 commit into
Conversation
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.
Summary
Assigning
niltojs_compressororcss_compressordisables the current compressor, including objects implementingcompress. Assigning another compressor replaces the previous one.Remember the actual registered processor separately from the existing public compressor reader value. A
compressobject is wrapped in a Proc, but removal previously used the reader symbol instead of that Proc. Existing reader values are preserved. Checks cover object-to-object, object-to-callable/class/symbol, nil, repeated nil, JS/CSS, processor counts and preservation of other processors. The reproduction clears the asset cache to isolate registration behavior; this does not solve arbitrary custom processor cache-key configuration.Reproduction
With
require "sprockets"; require "tmpdir":Verification
bundle exec rake testandbundle exec rake test_isolatedeach pass 913 tests / 4,109 assertions / zero failures/errors / four skips, on Ruby 3.2.11 and 4.0.6 with Rack 3.2.7.git diff --checkpasses.Compatibility and limitations
Breaking changes: no intended change to valid supported behavior; the incorrect behavior described above changes. No new dependencies or version upgrades. Nested configuration ownership, unrelated cache invalidation and HTTP behavior are outside this focused patch.
Based on installed release/current upstream main
49d9f20c00ac7d9a7ee57db058961edcccd86699. This is an upstream-only contribution; no personal fork is being adopted in the application. Older Ruby/Linux/JRuby verification is left to upstream CI, not claimed locally. No checked-in tests were added or edited under the requesting repository's no-test-edit policy; focused reproductions ran externally. Prepared with AI assistance. This does not claim exhaustive Sprockets coverage.