Shopify / liquid

Liquid markup language. Safe, customer facing template language for flexible web apps.
https://shopify.github.io/liquid/
MIT License
11.05k stars 1.38k forks source link

Fix for custom tag rendering #1750

Closed IevaGraz closed 9 months ago

IevaGraz commented 11 months ago

After https://github.com/Shopify/liquid/pull/1091 the behaviour when a render method of custom tags returns nil has changed. Before something like

 Liquid::Template.parse('foo {% custom_url%20SOME-CUSTOM-PARAM %}').render()

that depends on

 class CustomUrl < Liquid::Tag
     ...
    def render(_context)
      return unless something

      #build url
    end

Would return just foo. After the change it returns foo Liquid error: internal Because this line here throws TypeError: no implicit conversion of nil into String

ianks commented 9 months ago

Just checked this with our app's CI and it looks good. Thanks for the fix!