Fix api attachment urls

This commit is contained in:
2025-07-29 20:40:53 +03:30
parent ba06de2c11
commit a7ef859c43

View File

@@ -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)
}