Skip to content

Commit

Permalink
Merge pull request #1198 from nyaruka/trim_attachments
Browse files Browse the repository at this point in the history
Trim whitespace from evaluated message attachments
  • Loading branch information
rowanseymour authored Nov 30, 2023
2 parents c038a35 + ca2d1fd commit d6a67ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions flows/actions/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func (a *baseAction) evaluateMessage(run flows.Run, languages []i18n.Language, a
if err != nil {
logEvent(events.NewError(err))
}
evaluatedAttachment = strings.TrimSpace(evaluatedAttachment)
if evaluatedAttachment == "" {
logEvent(events.NewErrorf("attachment text evaluated to empty string, skipping"))
continue
Expand Down
2 changes: 1 addition & 1 deletion flows/actions/testdata/send_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"uuid": "ad154980-7bf7-4ab8-8728-545fd6378912",
"text": "Hi there",
"attachments": [
"@(\"\")"
"@(\" \")"
],
"quick_replies": [
"@(\"\")"
Expand Down

0 comments on commit d6a67ab

Please sign in to comment.