diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/issues_controller.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index c3f8ec8d5..07de47c0d 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -192,8 +192,16 @@ class IssuesController < ApplicationController def update return unless update_issue_from_params - @issue.save_attachments(params[:attachments] || - (params[:issue] && params[:issue][:uploads])) + attachments = params[:attachments] || params.dig(:issue, :uploads) + if @issue.attachments_addable? + @issue.save_attachments(attachments) + else + attachments = attachments.to_unsafe_hash if attachments.respond_to?(:to_unsafe_hash) + if [Hash, Array].any? { |klass| attachments.is_a?(klass) } && attachments.any? + flash[:warning] = l(:warning_attachments_not_saved, attachments.size) + end + end + saved = false begin saved = save_issue_with_child_records |