Skip to content

Commit

Permalink
Merge pull request #40 from weni-ai/fix/twilioflex-media-reply-panic
Browse files Browse the repository at this point in the history
fix: prevent panic on media reply if fetch error
  • Loading branch information
rasoro authored Sep 8, 2023
2 parents b05ec3c + cbf3b8c commit 4ecd91b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions WENI-CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.6.10-mailroom-7.1.22
----------
* Fix twilioflex panic on fetch media error

1.6.9-mailroom-7.1.22
----------
* Wenichats open room receiving defined custom fields of body is properly configured or all fields if not
Expand Down
2 changes: 1 addition & 1 deletion services/tickets/twilioflex/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ func handleEventCallback(ctx context.Context, rt *runtime.Runtime, r *http.Reque
return err, http.StatusBadRequest, nil
}
file, err := tickets.FetchFile(mediaContent.Links.ContentDirectTemporary, nil)
file.ContentType = mediaContent.ContentType
if err != nil {
return errors.Wrapf(err, "error fetching ticket file '%s'", mediaContent.Links.ContentDirectTemporary), http.StatusBadRequest, nil
}
file.ContentType = mediaContent.ContentType
_, err = tickets.SendReply(ctx, rt, ticket, request.Body, []*tickets.File{file})
if err != nil {
return err, http.StatusBadRequest, nil
Expand Down

0 comments on commit 4ecd91b

Please sign in to comment.