From 45846ea89d031c22ea49c26f2d71a67acf510d7a Mon Sep 17 00:00:00 2001 From: y-yoshinoya Date: Fri, 30 Oct 2020 13:42:09 +0900 Subject: [PATCH] fix upload problem for same file name by Redmine issue attachments --- app/controllers/dmsf_upload_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb index e00d6eb2..fba1b671 100644 --- a/app/controllers/dmsf_upload_controller.rb +++ b/app/controllers/dmsf_upload_controller.rb @@ -70,7 +70,12 @@ class DmsfUploadController < ApplicationController if defined?(EasyExtensions) @attachment.skip_description_required = true end - saved = @attachment.save + begin + Attachment.skip_callback(:commit, :after, :reuse_existing_file_if_possible) + saved = @attachment.save + ensure + Attachment.set_callback(:commit, :after, :reuse_existing_file_if_possible) + end respond_to do |format| format.js