Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This change fixes a bug in the replace_last filter where a nil argument for the string to be replaced would not cause the replacement to be appended.

When `replace_last` is called with a `nil` value for the string to be replaced, it should append the replacement string to the input.

This was not happening, and the filter was returning the input string unchanged.

This commit fixes this by checking if the string to be replaced is empty after being converted to a string, and if so, appending the replacement.

A doctest and an integration test have been added to cover this case.
@edgurgel edgurgel marked this pull request as ready for review August 10, 2025 08:49
@edgurgel edgurgel merged commit d1937e9 into main Aug 10, 2025
6 checks passed
@edgurgel edgurgel deleted the fix/replace-last-nil branch August 10, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant