`blank` treats Unicode whitespace differently depending on whether ActiveSupport is loaded
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
まず Condition#liquid_blank? と blank の比較テストを見つけます。文字列の空白を扱う式が issue の Unicode の例をどのように処理するか確認し、その後、関連する condition テストを実行します。ActiveSupport が読み込まれている場合も読み込まれていない場合も、Unicode の空白文字列が blank と比較されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
What happens
Without ActiveSupport, a string made only of Unicode whitespace (for example a non-breaking space " " or an ideographic space " ") is not blank. With ActiveSupport loaded, the same string is blank.
require 'liquid'
t = Liquid::Template.parse("{% if x == blank %}blank{% else %}not{% endif %}")
t.render!('x' => " ") # => "not"
require 'active_support/core_ext/object/blank'
t.render!('x' => " ") # => "blank"
What should happen
Both should return "blank". Condition#call_method_literal emulates ActiveSupport's blank? so that templates behave the same whether or not ActiveSupport is loaded, and the comment on liquid_blank? says it matches ActiveSupport.
Root cause
Condition#liquid_blank? checks strings with /\A\s*\z/. In Ruby \s only matches ASCII whitespace. ActiveSupport's String#blank? uses /\A[[:space:]]*\z/, which also matches Unicode space characters such as U+00A0, U+2003 and U+3000.
Non-breaking spaces are common in merchant content pasted from rich text editors, so a check like {% if block.settings.text == blank %} can give a different answer between environments.
- 主要言語
- Ruby
- スター
- 11.9k
- フォーク
- 1.6k
- 平均マージ
- 11時間 20分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Shopify/liquid のほかの issue
-
Fix Utils module to not expect arguments for inspect対応中かも @Hashim1999164 が 103 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Shopify/liquid#2107 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Fix Wiki referenceオープン
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
Wiki link updateオープン
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
hanami/hanami-action#536 ·
-
[2026-11] Latest release (2026-11) still has expanded list entries that are no longer supportedオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Shopify/product-taxonomy#1054 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 13 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
docker/model-runner#1118 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
TarteelAI/quranic-universal-library#1111 ·
メンテナーはふだん 1 日以内に返信