Unreleased
Unreleased - only on Staging
FIXED
-
Boolean filters return
false, not a truthy empty string, when their arguments are rejected: This affects Instances that run withliquid_raise_modedisabled. In that mode a filter that rejects its arguments reports the error and then hands a value back to the template so the render can carry on - and that value was always an empty string. Because''is truthy in Liquid, a filter that answers a yes/no question turned a rejected argument into a passing check -{% if result %}took the true branch even though the filter had just failed. Every filter documented as returning a boolean now returnsfalsewhen it rejects an argument:array_any,array_include,end_with,hcaptcha,is_date_before,is_date_in_past,is_email_valid,is_gpg_valid,is_token_valid,matches,start_withOnly the value handed back on the rejection path changes. Valid arguments give exactly the same answer as before, the error is still reported to your Instance logs with its usual
Liquid error (path:line): ...location and full diagnostic, and the documented blank-argument shortcuts stay silent -{{ '' | matches: 'a' }}still returns null and{{ '' | is_email_valid }}still returnsfalse, neither of which is an argument error.We strongly recommend keeping
liquid_raise_modeset totrue, which is the default.falseis a safer answer than a truthy'', but it is still only the least bad one - for a failed check there is no correct value to return at all. Take{{ 'not-a-date' | is_date_in_past }}:trueandfalseare both wrong, because the question was never answered, and either one silently sends your code down a branch it should never have taken. The only way to be sure a failed filter does not quietly decide your control flow is to let it stop the render. Withliquid_raise_modeon, a rejected argument raisesLiquidArgumentErrorand returns a 500 with a full diagnostic, so no placeholder value ever reaches the rest of your logic and this whole class of problem cannot occur.With it off, all the other filters still return
''on an argument error, so whenever a filter's result decides control flow you must write{% if result != blank %}rather than{% if result %}- the latter is true for the empty string and will take the wrong branch.{% if result != blank %}is the safe form for the boolean filters listed above too, sincefalseis also blank in Liquid. -
Non-HTML page formats are served as UTF-8: Pages rendered in a format other than
html-md,json,css,csv,ics,js,rss,svg,textandxml- now send a charset in theirContent-Typeheader, for exampletext/markdown; charset=utf-8instead of a baretext/markdown. Without it browsers and HTTP clients fell back to latin-1 and mangled every non-ASCII character, so accented letters and box-drawing characters in Markdown pages (such as the└──of a directory tree) rendered as garbage. HTML pages already sent the charset and are unaffected, and a page that sets its ownContent-Typethroughresponse_headersstill wins - use that if you need a different charset.