From b77c292500fad52a40da30e89f90489928878084 Mon Sep 17 00:00:00 2001 From: Robi9 Date: Thu, 22 Dec 2022 16:23:33 -0300 Subject: [PATCH 1/4] Add path in file url --- services/tickets/zendesk/service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/tickets/zendesk/service.go b/services/tickets/zendesk/service.go index 9fce039f4..efb5d7de5 100644 --- a/services/tickets/zendesk/service.go +++ b/services/tickets/zendesk/service.go @@ -318,7 +318,7 @@ func (s *service) convertAttachments(attachments []utils.Attachment) ([]string, path := strings.TrimPrefix(u.Path, prefix) path = strings.TrimPrefix(path, "/") - fileURLs[i] = "file/" + path + fileURLs[i] = "api/v2/s3/file/" + path } return fileURLs, nil } From 6aabaed887ed8436e5414e27947bb0d0187d20fd Mon Sep 17 00:00:00 2001 From: Robi9 Date: Thu, 22 Dec 2022 16:36:45 -0300 Subject: [PATCH 2/4] Add path to file url in .snap --- .../zendesk/testdata/TestOpenAndForward_forward_message.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap b/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap index 6207acfcc..f3cd0ce48 100644 --- a/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap +++ b/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap @@ -1,9 +1,9 @@ POST /api/v2/any_channel/push.json HTTP/1.1 Host: nyaruka.zendesk.com User-Agent: Go-http-client/1.1 -Content-Length: 409 +Content-Length: 419 Authorization: Bearer **************** Content-Type: application/json Accept-Encoding: gzip -{"instance_push_id":"1234-abcd","request_id":"sesame:1570461700000000000","external_resources":[{"external_id":"ca5607f0-cba8-4c94-9cd5-c4fbc24aa767","message":"It's urgent","thread_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","created_at":"2019-10-07T15:21:39Z","author":{"external_id":"6393abc0-283d-4c9b-a1b3-641a035c34bf","name":"Cathy"},"allow_channelback":true,"file_urls":["file/0123/attachment1.jpg"]}]} \ No newline at end of file +{"instance_push_id":"1234-abcd","request_id":"sesame:1570461700000000000","external_resources":[{"external_id":"ca5607f0-cba8-4c94-9cd5-c4fbc24aa767","message":"It's urgent","thread_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","created_at":"2019-10-07T15:21:39Z","author":{"external_id":"6393abc0-283d-4c9b-a1b3-641a035c34bf","name":"Cathy"},"allow_channelback":true,"file_urls":["api/v2/s3/file/0123/attachment1.jpg"]}]} \ No newline at end of file From f22ae6ba15ec50715dfbac7446b0f0ba8427d4ea Mon Sep 17 00:00:00 2001 From: Robi9 Date: Fri, 23 Dec 2022 15:47:49 -0300 Subject: [PATCH 3/4] Fix path for url of Zendesk files --- services/tickets/zendesk/service.go | 2 +- .../zendesk/testdata/TestOpenAndForward_forward_message.snap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/tickets/zendesk/service.go b/services/tickets/zendesk/service.go index efb5d7de5..d52c63bdc 100644 --- a/services/tickets/zendesk/service.go +++ b/services/tickets/zendesk/service.go @@ -318,7 +318,7 @@ func (s *service) convertAttachments(attachments []utils.Attachment) ([]string, path := strings.TrimPrefix(u.Path, prefix) path = strings.TrimPrefix(path, "/") - fileURLs[i] = "api/v2/s3/file/" + path + fileURLs[i] = "api/v2/file/" + path } return fileURLs, nil } diff --git a/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap b/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap index f3cd0ce48..45cfb55d4 100644 --- a/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap +++ b/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap @@ -6,4 +6,4 @@ Authorization: Bearer **************** Content-Type: application/json Accept-Encoding: gzip -{"instance_push_id":"1234-abcd","request_id":"sesame:1570461700000000000","external_resources":[{"external_id":"ca5607f0-cba8-4c94-9cd5-c4fbc24aa767","message":"It's urgent","thread_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","created_at":"2019-10-07T15:21:39Z","author":{"external_id":"6393abc0-283d-4c9b-a1b3-641a035c34bf","name":"Cathy"},"allow_channelback":true,"file_urls":["api/v2/s3/file/0123/attachment1.jpg"]}]} \ No newline at end of file +{"instance_push_id":"1234-abcd","request_id":"sesame:1570461700000000000","external_resources":[{"external_id":"ca5607f0-cba8-4c94-9cd5-c4fbc24aa767","message":"It's urgent","thread_id":"59d74b86-3e2f-4a93-aece-b05d2fdcde0c","created_at":"2019-10-07T15:21:39Z","author":{"external_id":"6393abc0-283d-4c9b-a1b3-641a035c34bf","name":"Cathy"},"allow_channelback":true,"file_urls":["api/v2/file/0123/attachment1.jpg"]}]} \ No newline at end of file From d62e3f07efa7075666de429ac3ab3f3c589d153d Mon Sep 17 00:00:00 2001 From: Robi9 Date: Fri, 23 Dec 2022 15:57:51 -0300 Subject: [PATCH 4/4] fix .snap --- .../zendesk/testdata/TestOpenAndForward_forward_message.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap b/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap index 45cfb55d4..a7bff213c 100644 --- a/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap +++ b/services/tickets/zendesk/testdata/TestOpenAndForward_forward_message.snap @@ -1,7 +1,7 @@ POST /api/v2/any_channel/push.json HTTP/1.1 Host: nyaruka.zendesk.com User-Agent: Go-http-client/1.1 -Content-Length: 419 +Content-Length: 416 Authorization: Bearer **************** Content-Type: application/json Accept-Encoding: gzip