@@ -1727,9 +1727,12 @@ func UpdateIssueContent(ctx *context.Context) {
1727
1727
return
1728
1728
}
1729
1729
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
+ }
1733
1736
}
1734
1737
1735
1738
content , err := markdown .RenderString (& markup.RenderContext {
@@ -2148,20 +2151,19 @@ func UpdateCommentContent(ctx *context.Context) {
2148
2151
return
2149
2152
}
2150
2153
2151
- if ctx .FormBool ("ignore_attachments" ) {
2152
- return
2153
- }
2154
-
2155
2154
if comment .Type == models .CommentTypeComment {
2156
2155
if err := comment .LoadAttachments (); err != nil {
2157
2156
ctx .ServerError ("LoadAttachments" , err )
2158
2157
return
2159
2158
}
2160
2159
}
2161
2160
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
+ }
2165
2167
}
2166
2168
2167
2169
content , err := markdown .RenderString (& markup.RenderContext {
0 commit comments