1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-10 03:28:20 +00:00

For API attachments, use API URL (#25639) (#25814)

Backport #25639 by @lunny

Fix #25257

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Giteabot
2023-07-10 08:56:16 -04:00
committed by GitHub
parent b4460cf541
commit 2b79d3fd52
19 changed files with 108 additions and 67 deletions

View File

@@ -2036,7 +2036,7 @@ func GetIssueInfo(ctx *context.Context) {
}
}
ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, issue))
ctx.JSON(http.StatusOK, convert.ToIssue(ctx, issue))
}
// UpdateIssueTitle change issue's title
@@ -2541,7 +2541,7 @@ func SearchIssues(ctx *context.Context) {
}
ctx.SetTotalCountHeader(filteredCount)
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, issues))
}
func getUserIDForFilter(ctx *context.Context, queryName string) int64 {
@@ -2702,7 +2702,7 @@ func ListIssues(ctx *context.Context) {
}
ctx.SetTotalCountHeader(filteredCount)
ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
ctx.JSON(http.StatusOK, convert.ToIssueList(ctx, issues))
}
// UpdateIssueStatus change issue's status
@@ -3263,7 +3263,7 @@ func GetIssueAttachments(ctx *context.Context) {
}
attachments := make([]*api.Attachment, len(issue.Attachments))
for i := 0; i < len(issue.Attachments); i++ {
attachments[i] = convert.ToAttachment(issue.Attachments[i])
attachments[i] = convert.ToAttachment(ctx.Repo.Repository, issue.Attachments[i])
}
ctx.JSON(http.StatusOK, attachments)
}
@@ -3287,7 +3287,7 @@ func GetCommentAttachments(ctx *context.Context) {
return
}
for i := 0; i < len(comment.Attachments); i++ {
attachments = append(attachments, convert.ToAttachment(comment.Attachments[i]))
attachments = append(attachments, convert.ToAttachment(ctx.Repo.Repository, comment.Attachments[i]))
}
ctx.JSON(http.StatusOK, attachments)
}