botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
83 stars 91 forks source link

[BUG] Inconsistent escaping behavior #1451

Open ptrckbp opened 3 years ago

ptrckbp commented 3 years ago

Describe the bug Images content escapes variables by default, and text doesn't. There doesn't seem to be any warning of this anywhere.

image

image

The solution to have the image display is including triple braces. I just guessed it would work from my experience and it did.

To Reproduce Steps to reproduce the behavior:

  1. Go to flows
  2. Create a node
  3. Get the url of an image (like this one)
  4. setVariable temp.url that url
  5. create an image action, with the image field set to {{url}}
  6. create a text action, with the text field set to {{url}}
  7. try it out in the emulator. The image shouldn't appear, unless you use triple braces {{{ }}}

Expected behavior There should at least be a warning in the image content (and any other content where this might be a problem). Also, the behavior of the title is also escaped, even though it's similar to a text field. Otherwise, the notation should be standard ({{escaped}} {{{unescaped}}}), although I realize that change would be a lot more costly.

Environment (please complete the following information):

Additional context

Related to https://github.com/botpress/v12/issues/191

ptrckbp commented 3 years ago

Another point : image This doesn't mention anything about triple braces, but, maybe it could be mentioned in the popup, if we are going that way.