Fix custom tag render result stringification#2104
Open
sjh9714 wants to merge 1 commit into
Open
Conversation
Author
|
I have signed the CLA! |
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
Fixes #1893.
Custom tags that rely on the legacy
render(context)compatibility path were appending non-string render results directly to the output buffer. That made an integer render result useString#<<byte semantics, so49rendered as1. This restores the pre-refactor behavior by joining array render results and stringifying other truthy render results before appending.Changes
Testing
mainworktree:docker run --rm -v /tmp/liquid-red-1893:/repo -w /repo ruby:4.0.2 ruby -Itest -Ilib test/integration/tag_test.rb -n /stringify/failed withExpected: "49",Actual: "1".docker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -Itest -Ilib test/integration/tag_test.rb -n /stringify/docker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -Itest -Ilib test/integration/tag_test.rbdocker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -Itest -Ilib test/integration/block_test.rbdocker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -c lib/liquid/tag.rbdocker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -c test/integration/tag_test.rbgit diff --checkVerification gap: I also tried
ruby -Itest -Ilib -S rake base_testin the Ruby 4.0.2 container, but the plain container lackedlru_redux. A disposable Bundler install was blocked because theShopify/liquid-specbranchself-drop-env-lookup-specscould not be resolved.Note: I used Codex while preparing this change, reviewed the final diff, and ran the listed checks locally.