Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix mail handler using attachment service

Oliver Günther190a75c19239
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 471d6dca74d..5beaddf97d3 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -272,9 +272,15 @@ class MailHandler < ActionMailer::Base
binary: true
)
- ::Attachments::CreateService
- .new(container, author: user)
- .call(uploaded_file: file, description: nil)
+ call = ::Attachments::CreateService
+ .new(user: user)
+ .call(container: container, filename: attachment.filename, file: file)
+
+ call.on_failure do
+ log "Failed to add attachment #{attachment.filename} for [#{sender_email}]: #{call.message}"
+ end
+
+ call.result
end
# Adds To and Cc as watchers of the given object if the sender has the