Skip to content

Error when the safe filter receives an undefined value - #1054

Merged
Keats merged 1 commit into
Keats:masterfrom
mamicicekel:fix/safe-undefined-errors
Oct 27, 2026
Merged

Keats merged 1 commit into
Keats:masterfrom
mamicicekel:fix/safe-undefined-errors

Conversation

@mamicicekel

@mamicicekel mamicicekel commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

{{ missing }} already fails. {{ missing | safe }} did not: converting undefined to Cow<str> formatted it as an empty string, so the safe filter marked a blank as HTML-safe.

Reject undefined in that conversion. The error is expected string but got undefined. | default(value=...) is unchanged because it takes Value.

Fixes #1050.

Cow<str> conversion formatted undefined as an empty string, so
{{ missing | safe }} rendered blank while {{ missing }} already
errors. Reject undefined there so string filters match the existing
undefined contract. default() still takes Value and is unchanged.
Comment thread tera/src/args.rs Resolved
@Keats
Keats merged commit 9be0703 into Keats:master Oct 27, 2026
5 checks passed
@Keats

Keats commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

| safe silently ignore undefined variables

3 participants