From b712cda9cf086dfd5f43b18c30641f3ef4fc59e4 Mon Sep 17 00:00:00 2001 From: Mehul Jariwala Date: Thu, 1 Oct 2026 23:23:13 +0530 Subject: [PATCH 1/2] Fix raw closing tags immediately after a variable opener Assisted-by: OpenAI Codex --- lib/liquid/tokenizer.rb | 6 ++++++ test/integration/tags/raw_tag_test.rb | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/lib/liquid/tokenizer.rb b/lib/liquid/tokenizer.rb index 8b331d93c..41a70c131 100644 --- a/lib/liquid/tokenizer.rb +++ b/lib/liquid/tokenizer.rb @@ -9,6 +9,7 @@ class Tokenizer TAG_END = /%\}/ TAG_OR_VARIABLE_START = /\{[\{\%]/ NEWLINE = /\n/ + RAW_TAG_END = /-?\s*endraw\s*-?%\}/ OPEN_CURLEY = "{".ord CLOSE_CURLEY = "}".ord @@ -116,6 +117,11 @@ def next_variable_token byte_a = byte_b = @ss.scan_byte + # The second opening brace can start a tag, e.g. {{% endraw %}}. + if byte_a == PERCENTAGE && @ss.match?(RAW_TAG_END) + return next_tag_token_with_start(start) + end + while byte_b byte_a = @ss.scan_byte while byte_a && byte_a != CLOSE_CURLEY && byte_a != OPEN_CURLEY diff --git a/test/integration/tags/raw_tag_test.rb b/test/integration/tags/raw_tag_test.rb index 2ca43d3b2..501072c4b 100644 --- a/test/integration/tags/raw_tag_test.rb +++ b/test/integration/tags/raw_tag_test.rb @@ -36,4 +36,10 @@ def test_invalid_raw assert_match_syntax_error(/Valid syntax/, '{% raw } foo {% endraw %}') assert_match_syntax_error(/Valid syntax/, '{% raw } foo %}{% endraw %}') end + + def test_endraw_after_variable_start_with_trailing_brace + assert_template_result('%{}x', '{%raw%}%{{%endraw%}}{%raw%}x{%endraw%}') + assert_template_result('{}}after', '{% raw %}{{% endraw %}}}after') + assert_template_result('{x', '{% raw %}{{%- endraw -%} {{ "x" }}') + end end From 8c2685e64c199b307b02839a2674c47c8192074f Mon Sep 17 00:00:00 2001 From: Mehul Jariwala Date: Fri, 2 Oct 2026 00:22:07 +0530 Subject: [PATCH 2/2] Re-run Shopify CLA verification after signing