@@ -1728,10 +1728,12 @@ func UpdateIssueContent(ctx *context.Context) {
1728
1728
return
1729
1729
}
1730
1730
1731
- files := ctx .QueryStrings ("files[]" )
1732
- if err := updateAttachments (issue , files ); err != nil {
1733
- ctx .ServerError ("UpdateAttachments" , err )
1734
- return
1731
+ // when update the request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates
1732
+ if ! ctx .QueryBool ("ignore_attachments" ) {
1733
+ if err := updateAttachments (issue , ctx .QueryStrings ("files[]" )); err != nil {
1734
+ ctx .ServerError ("UpdateAttachments" , err )
1735
+ return
1736
+ }
1735
1737
}
1736
1738
1737
1739
content , err := markdown .RenderString (& markup.RenderContext {
@@ -2149,20 +2151,19 @@ func UpdateCommentContent(ctx *context.Context) {
2149
2151
return
2150
2152
}
2151
2153
2152
- if ctx .QueryBool ("ignore_attachments" ) {
2153
- return
2154
- }
2155
-
2156
2154
if comment .Type == models .CommentTypeComment {
2157
2155
if err := comment .LoadAttachments (); err != nil {
2158
2156
ctx .ServerError ("LoadAttachments" , err )
2159
2157
return
2160
2158
}
2161
2159
}
2162
2160
2163
- if err := updateAttachments (comment , ctx .QueryStrings ("files[]" )); err != nil {
2164
- ctx .ServerError ("UpdateAttachments" , err )
2165
- return
2161
+ // when the update request doesn't intend to update attachments (eg: change checkbox state), ignore attachment updates
2162
+ if ! ctx .QueryBool ("ignore_attachments" ) {
2163
+ if err := updateAttachments (comment , ctx .QueryStrings ("files[]" )); err != nil {
2164
+ ctx .ServerError ("UpdateAttachments" , err )
2165
+ return
2166
+ }
2166
2167
}
2167
2168
2168
2169
content , err := markdown .RenderString (& markup.RenderContext {
0 commit comments