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

[#49140] added guard to not override params

Eric Schubertd518f74eea97
diff --git a/modules/storages/app/services/storages/project_storages/set_attributes_service.rb b/modules/storages/app/services/storages/project_storages/set_attributes_service.rb
index 12d7a6aaefb..1d6a6063ebf 100644
--- a/modules/storages/app/services/storages/project_storages/set_attributes_service.rb
+++ b/modules/storages/app/services/storages/project_storages/set_attributes_service.rb
@@ -29,10 +29,12 @@
# Used by: CreateService when setting attributes
module Storages::ProjectStorages
class SetAttributesService < ::BaseServices::SetAttributes
- def set_default_attributes(_params)
+ def set_default_attributes(params)
model.creator ||= user
- if model.storage.present? && model.storage.automatically_managed?
+ if params[:project_folder_mode].blank? && model.storage.present? && model.storage.automatically_managed?
+ # set default to automatic, if related storage is automatically managed
+ # do NOT override values set in params
model.project_folder_mode = "automatic"
end
end