@@ -1727,9 +1727,12 @@ func UpdateIssueContent(ctx *context.Context) {
17271727 return
17281728 }
17291729
1730- if err := updateAttachments (issue , ctx .FormStrings ("files[]" )); err != nil {
1731- ctx .ServerError ("UpdateAttachments" , err )
1732- return
1730+ // when update the request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates
1731+ if ! ctx .FormBool ("ignore_attachments" ) {
1732+ if err := updateAttachments (issue , ctx .FormStrings ("files[]" )); err != nil {
1733+ ctx .ServerError ("UpdateAttachments" , err )
1734+ return
1735+ }
17331736 }
17341737
17351738 content , err := markdown .RenderString (& markup.RenderContext {
@@ -2148,20 +2151,19 @@ func UpdateCommentContent(ctx *context.Context) {
21482151 return
21492152 }
21502153
2151- if ctx .FormBool ("ignore_attachments" ) {
2152- return
2153- }
2154-
21552154 if comment .Type == models .CommentTypeComment {
21562155 if err := comment .LoadAttachments (); err != nil {
21572156 ctx .ServerError ("LoadAttachments" , err )
21582157 return
21592158 }
21602159 }
21612160
2162- if err := updateAttachments (comment , ctx .FormStrings ("files[]" )); err != nil {
2163- ctx .ServerError ("UpdateAttachments" , err )
2164- return
2161+ // when the update request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates
2162+ if ! ctx .FormBool ("ignore_attachments" ) {
2163+ if err := updateAttachments (comment , ctx .FormStrings ("files[]" )); err != nil {
2164+ ctx .ServerError ("UpdateAttachments" , err )
2165+ return
2166+ }
21652167 }
21662168
21672169 content , err := markdown .RenderString (& markup.RenderContext {
0 commit comments