Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version patch #1874

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Liquid Change Log

## 5.6.0 (unreleased)

### Fixes

* Fix Tokenizer to handle null source value (#1873) [Bahar Pourazar]


## 5.5.0 2024-03-21

Please reference the GitHub release for more information.
Expand Down
2 changes: 1 addition & 1 deletion lib/liquid/tokenizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Tokenizer
attr_reader :line_number, :for_liquid_tag

def initialize(source, line_numbers = false, line_number: nil, for_liquid_tag: false)
@source = source.to_s
@source = source.to_s.to_str
Copy link
Member Author

@bahar-p bahar-p Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity:

This is necessary to handle cases where to_s returns a subclass of String but we explicitly want to turn it into an instance of String.

As stated in this PR, ActiveSupport::SafeBuffer is one that we need to handle. It is a subclass of String. Calling ActiveSupport::SafeBuffer#to_s returns self (an instance of safe_buffer) however, what we actually want is an instance of String. Calling to_str ensures we're always dealing with an instance of String

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just do?

Suggested change
@source = source.to_s.to_str
@source = source.to_str

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@line_number = line_number || (line_numbers ? 1 : nil)
@for_liquid_tag = for_liquid_tag
@offset = 0
Expand Down
2 changes: 1 addition & 1 deletion lib/liquid/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# frozen_string_literal: true

module Liquid
VERSION = "5.6.0.rc2"
VERSION = "5.6.0.rc3"
end
Loading