Fix api attachment urls
This commit is contained in:
@@ -21,9 +21,9 @@ func InitApiEndpointHandler() {
|
|||||||
|
|
||||||
func (ps *ApiEndpointHandler) GetRandomPost(c *gin.Context) {
|
func (ps *ApiEndpointHandler) GetRandomPost(c *gin.Context) {
|
||||||
post := ps.PostService.GetRandomPost()
|
post := ps.PostService.GetRandomPost()
|
||||||
for _, attachment := range post.Attachments {
|
for i := range post.Attachments {
|
||||||
attachment.RemoteUrl = services.GetRemoteUrl(attachment.RemoteUrl)
|
post.Attachments[i].RemoteUrl = services.GetRemoteUrl(post.Attachments[i].RemoteUrl)
|
||||||
attachment.PreviewUrl = services.GetPreviewUrl(attachment.RemoteUrl)
|
post.Attachments[i].PreviewUrl = services.GetPreviewUrl(post.Attachments[i].RemoteUrl)
|
||||||
}
|
}
|
||||||
c.JSON(200, post)
|
c.JSON(200, post)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user