Skip to content

Incorrect decoding of external condition expressions #37

Description

@imaginoCDP

Current version

Stripo 1.162.0

Description:

When saving 'EXTERNAL' conditions in stripo, values passed to openExternalDisplayConditionsDialog callback are not correctly decoded back.

Steps to Reproduce

  • Setup basic external conditions on the editor
Image

 

  • Then pass this value on condition submit
{

  "inlineExpr": "\"Some space\": test > 'aa'",
  "beforeScript": "{{#if \"Some space\": test > 'aa' }}",
  "afterScript": "{{/if}}",
  "type": "EXTERNAL",
  "category": "Conditions with imagino",
  "id": "1750277847545"
}
  • Save the editor content (stripo apply external conditions on the body of the content)

  • Then open the saved template (with the previous external conditions applied)

  • Select the container on witch we previously apply the conditions and click on "Condition Applied (1)" to open the external conditions modal

Image
  • We receive bad decoded version of our applied external condition
Image

Below the console log of the editedCondition passed by stripo.
Note the presence of > 'aa' passed by stripo instead of test > 'aa' initially provided

{

  "inlineExpr": "\"Some space\": test > 'aa'",
  "beforeScript": "{{#if \"Some space\": test > 'aa' }}",
  "afterScript": "{{/if}}",
  "type": "EXTERNAL",
  "category": "Conditions with imagino",
  "id": "1750277847545"
}

This breaks our internal api, critical for email processing.

Actual Result

Bad decoded condition by stripo

{

  "inlineExpr": "\"Some space\": test > 'aa'",
  "beforeScript": "{{#if \"Some space\": test > 'aa' }}",
  "afterScript": "{{/if}}",
  "type": "EXTERNAL",
  "category": "Conditions with imagino",
  "id": "1750277847545"
}

Expected Result

The original condition provided.

{

  "inlineExpr": "\"Some space\": test > 'aa'",
  "beforeScript": "{{#if \"Some space\": test > 'aa' }}",
  "afterScript": "{{/if}}",
  "type": "EXTERNAL",
  "category": "Conditions with imagino",
  "id": "1750277847545"
}

Workaround (optional)

Any workaround we can try could potential be dangerous since we are not responsible for saving/retrieving the external condition in/from the template. This is crucial for us

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions