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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
handle pending attachment validation errors
Markus Kahlb85380f0684f
diff --git a/app/models/attachment.rb b/app/models/attachment.rbindex 39caceb3309..4484601c042 100644--- a/app/models/attachment.rb+++ b/app/models/attachment.rb@@ -256,10 +256,10 @@ class Attachment < ApplicationRecordenddef self.create_pending_direct_upload(file_name:, author:, container: nil, content_type: nil, file_size: 0)- a = create(+ a = new(container: container,author: author,- content_type: content_type || "application/octet-stream",+ content_type: content_type.presence || "application/octet-stream",filesize: file_size,digest: "",downloads: -1@@ -269,7 +269,7 @@ class Attachment < ApplicationRecord# to upload usually. But in this case the data has already been uploaded and we just point to it.a[:file] = file_name- a.reload unless a.new_record?+ a.save!aenddiff --git a/lib/api/v3/attachments/attachments_by_container_api.rb b/lib/api/v3/attachments/attachments_by_container_api.rbindex 10ee4be59a4..046e2d8123c 100644--- a/lib/api/v3/attachments/attachments_by_container_api.rb+++ b/lib/api/v3/attachments/attachments_by_container_api.rb@@ -77,7 +77,9 @@ module API)end- create_attachment metadata+ with_handled_create_errors do+ create_attachment metadata+ endenddef create_attachment(metadata)