@ -16,6 +16,7 @@ import (
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/services/attachment"
"code.gitea.io/gitea/services/attachment"
"code.gitea.io/gitea/services/context"
"code.gitea.io/gitea/services/context"
"code.gitea.io/gitea/services/context/upload"
"code.gitea.io/gitea/services/convert"
"code.gitea.io/gitea/services/convert"
issue_service "code.gitea.io/gitea/services/issue"
issue_service "code.gitea.io/gitea/services/issue"
)
)
@ -160,6 +161,8 @@ func CreateIssueCommentAttachment(ctx *context.APIContext) {
// "$ref": "#/responses/forbidden"
// "$ref": "#/responses/forbidden"
// "404":
// "404":
// "$ref": "#/responses/error"
// "$ref": "#/responses/error"
// "422":
// "$ref": "#/responses/validationError"
// "423":
// "423":
// "$ref": "#/responses/repoArchivedError"
// "$ref": "#/responses/repoArchivedError"
@ -194,9 +197,14 @@ func CreateIssueCommentAttachment(ctx *context.APIContext) {
CommentID : comment . ID ,
CommentID : comment . ID ,
} )
} )
if err != nil {
if err != nil {
ctx . Error ( http . StatusInternalServerError , "UploadAttachment" , err )
if upload . IsErrFileTypeForbidden ( err ) {
ctx . Error ( http . StatusUnprocessableEntity , "" , err )
} else {
ctx . Error ( http . StatusInternalServerError , "UploadAttachment" , err )
}
return
return
}
}
if err := comment . LoadAttachments ( ctx ) ; err != nil {
if err := comment . LoadAttachments ( ctx ) ; err != nil {
ctx . Error ( http . StatusInternalServerError , "LoadAttachments" , err )
ctx . Error ( http . StatusInternalServerError , "LoadAttachments" , err )
return
return