fix(array_to_sentence_string): coerce non-array input with toArray - #968
Closed
josefguenther wants to merge 1 commit into
Closed
josefguenther wants to merge 1 commit into
josefguenther wants to merge 1 commit into
Conversation
array_to_sentence_string read `.length` and `.slice` on its input directly, so a nil value, a number or a string of three or more characters threw a RenderError and failed the whole render, and a one- or two-character string was split into characters. It now coerces its input with `toArray`, as the other array filters do: nil renders an empty string and a non-array value is treated as a single item. Fixes harttle#964 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
|
This filter comes from Jekyll and I find Jekyll also throws for these cases thus it should be left that way. Unless you find otherwise, I'm closing this one. |
Contributor
Author
|
Thanks for checking. Jekyll's version just calls
Of the 24 Jekyll filters LiquidJS ports, |
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.
array_to_sentence_stringreads.lengthand.sliceon its input directly (src/filters/string.ts:226), so anything that isn't an array fails the whole render.{{ v | array_to_sentence_string }}:v55"abc"abc"ab"a and bab["a", "b", "c"]a, b, and cThis coerces the input with
toArray, as the other array filters do, so nil renders an empty string and a non-array value is treated as a single item. Array input is unchanged.The two new tests in
test/integration/filters/string.spec.tsfail on master and pass here.npm run build,npm test(1674 tests) andnpm run lintpass on Node 24.11.1.Fixes #964
Written with AI assistance (Claude Code); I have reviewed the change.