mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-30 04:15:21 +00:00
when the update request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates (#16762)
This commit is contained in:
parent
0bd58d61e5
commit
06f82641cb
|
@ -1727,9 +1727,12 @@ func UpdateIssueContent(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := updateAttachments(issue, ctx.FormStrings("files[]")); err != nil {
|
// when update the request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates
|
||||||
ctx.ServerError("UpdateAttachments", err)
|
if !ctx.FormBool("ignore_attachments") {
|
||||||
return
|
if err := updateAttachments(issue, ctx.FormStrings("files[]")); err != nil {
|
||||||
|
ctx.ServerError("UpdateAttachments", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content, err := markdown.RenderString(&markup.RenderContext{
|
content, err := markdown.RenderString(&markup.RenderContext{
|
||||||
|
@ -2148,10 +2151,6 @@ func UpdateCommentContent(ctx *context.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.FormBool("ignore_attachments") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if comment.Type == models.CommentTypeComment {
|
if comment.Type == models.CommentTypeComment {
|
||||||
if err := comment.LoadAttachments(); err != nil {
|
if err := comment.LoadAttachments(); err != nil {
|
||||||
ctx.ServerError("LoadAttachments", err)
|
ctx.ServerError("LoadAttachments", err)
|
||||||
|
@ -2159,9 +2158,12 @@ func UpdateCommentContent(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := updateAttachments(comment, ctx.FormStrings("files[]")); err != nil {
|
// when the update request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates
|
||||||
ctx.ServerError("UpdateAttachments", err)
|
if !ctx.FormBool("ignore_attachments") {
|
||||||
return
|
if err := updateAttachments(comment, ctx.FormStrings("files[]")); err != nil {
|
||||||
|
ctx.ServerError("UpdateAttachments", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content, err := markdown.RenderString(&markup.RenderContext{
|
content, err := markdown.RenderString(&markup.RenderContext{
|
||||||
|
|
Loading…
Reference in a new issue