diff --git a/cmd/chat.go b/cmd/chat.go index 582bd6da..e30f6b42 100644 --- a/cmd/chat.go +++ b/cmd/chat.go @@ -688,9 +688,6 @@ func sendChatMessageResponse(app *App, r *fastglue.Request, messageUUID string) return r.SendErrorEnvelope(fasthttp.StatusInternalServerError, app.i18n.T("globals.messages.somethingWentWrong"), nil, envelope.GeneralError) } - for i := range message.Attachments { - message.Attachments[i].URL = app.media.GetSignedURL(message.Attachments[i].UUID) - } app.conversation.SignAvatarURL(&message.Author.AvatarURL) // Strip agent email from widget responses. diff --git a/cmd/messages.go b/cmd/messages.go index 081e4d0d..e74a76c1 100644 --- a/cmd/messages.go +++ b/cmd/messages.go @@ -66,11 +66,7 @@ func handleGetMessages(r *fastglue.Request) error { rootURL, _ := app.setting.GetAppRootURL() for i := range messages { total = messages[i].Total - // Populate attachment URLs - for j := range messages[i].Attachments { - att := messages[i].Attachments[j] - messages[i].Attachments[j].URL = app.media.GetURL(att.UUID, att.ContentType, att.Name) - } + app.conversation.SignAttachmentURLs(messages[i].Attachments) resolveQuotedCIDs(app, &messages[i]) resolveAttachmentCIDs(&messages[i], rootURL) } @@ -135,10 +131,7 @@ func handleGetMessage(r *fastglue.Request) error { } rootURL, _ := app.setting.GetAppRootURL() - for j := range message.Attachments { - att := message.Attachments[j] - message.Attachments[j].URL = app.media.GetURL(att.UUID, att.ContentType, att.Name) - } + app.conversation.SignAttachmentURLs(message.Attachments) resolveQuotedCIDs(app, &message) resolveAttachmentCIDs(&message, rootURL) diff --git a/frontend/apps/main/src/features/conversation/message/attachment/BubbleAttachmentItem.vue b/frontend/apps/main/src/features/conversation/message/attachment/BubbleAttachmentItem.vue index 870494ca..82cc152c 100644 --- a/frontend/apps/main/src/features/conversation/message/attachment/BubbleAttachmentItem.vue +++ b/frontend/apps/main/src/features/conversation/message/attachment/BubbleAttachmentItem.vue @@ -13,9 +13,10 @@ >