st2flow icon indicating copy to clipboard operation
st2flow copied to clipboard

Escaping Jinja expressions

Open LindsayHill opened this issue 6 years ago • 1 comments

From Nick

When i try to enter an expression to a task input or task transition 'when', if i put a " or a \ it automatically escapes it for me, so i'm unable to make valid Jinja expressions

version: 1.0
    tasks:
      # [189, 75]
      hello_world:
        action: core.echo
        input:
          message: {{ ctx().message }}
        next:
          # #629e47
          - do:
              - task2
            when: {{ succeeded() }}
            publish:
              - thisvar: {{ result() }}
      # [400, 231]
      task2:
        action: core.local
        input:
          cmd: "\"echo '{{ ctx().thisvar }}'\""
    input:
      - message

LindsayHill avatar Apr 12 '19 01:04 LindsayHill

I'm not sure how to handle this from UX perspective. Meaning if you leave the quotes out then it is desired behavior. If we don't escape quotes that could lead to some interesting failure modes.

bigmstone avatar Apr 12 '19 17:04 bigmstone