From a7ef859c43b4bacc5790468c2981cecea5ad79a7 Mon Sep 17 00:00:00 2001 From: Mohammad Mahdi Date: Tue, 29 Jul 2025 20:40:53 +0330 Subject: [PATCH] Fix api attachment urls --- internal/web/handlers/apiEndpoint.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/web/handlers/apiEndpoint.go b/internal/web/handlers/apiEndpoint.go index 5b5c74c..5948bec 100644 --- a/internal/web/handlers/apiEndpoint.go +++ b/internal/web/handlers/apiEndpoint.go @@ -21,9 +21,9 @@ func InitApiEndpointHandler() { func (ps *ApiEndpointHandler) GetRandomPost(c *gin.Context) { post := ps.PostService.GetRandomPost() - for _, attachment := range post.Attachments { - attachment.RemoteUrl = services.GetRemoteUrl(attachment.RemoteUrl) - attachment.PreviewUrl = services.GetPreviewUrl(attachment.RemoteUrl) + for i := range post.Attachments { + post.Attachments[i].RemoteUrl = services.GetRemoteUrl(post.Attachments[i].RemoteUrl) + post.Attachments[i].PreviewUrl = services.GetPreviewUrl(post.Attachments[i].RemoteUrl) } c.JSON(200, post) }