Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaping doesn't work as expected #80

Closed
joshuataylor opened this issue Aug 30, 2022 · 0 comments · Fixed by #81
Closed

Escaping doesn't work as expected #80

joshuataylor opened this issue Aug 30, 2022 · 0 comments · Fixed by #81

Comments

@joshuataylor
Copy link
Sponsor Contributor

joshuataylor commented Aug 30, 2022

Description

When using {{ '\'' }}, the following error is thrown:

called `Result::unwrap()` on an `Err` value: Error { kind: BadEscape, detail: None, name: Some("concat.txt"), lineno: 2, source: None }

(Ignore the test file, I initially thought it might be a concat issue, it's not.

Reproduction steps

    let mut env = Environment::new();
    env.add_template("escape", "{{ '\'' }}").unwrap();

Additional helpful information:

  • Version of minijinja: Latest git (310a12b)
  • Version of rustc: rustc 1.65.0-nightly (bc4b39c27 2022-08-29)
  • Operating system and version: ArchLinux btw 5.19

What did you expect

It escaped.

It's handy to do things like this:

{% set result = run_query('select add_months(\''~ start_month ~ '-01\'::date, 11)::date') %}

Though you should use " ;).

{% set result = run_query("select add_months('"~ start_month ~ "'-01'::date, 11)::date") %}

I'm looking into this, just thought I should raise it 👍

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 a pull request may close this issue.

1 participant