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
[#42226] Psych::DisallowedClass: Tried to load unspecified class: URI::Generic while upgrading from 12.01 to 12.10
Christophe Bliard99af076a4c08
diff --git a/app/models/setting.rb b/app/models/setting.rbindex cc0e524d1da..7bc8a447721 100644--- a/app/models/setting.rb+++ b/app/models/setting.rb@@ -325,8 +325,8 @@ class Setting < ApplicationRecorddefinition = Settings::Definition[name]if definition.serialized? && value.is_a?(String)- YAML::safe_load(value, permitted_classes: [Symbol, ActiveSupport::HashWithIndifferentAccess, Date, Time])- .tap { |maybe_hash| maybe_hash.try(:deep_stringify_keys!) }+ YAML::safe_load(value, permitted_classes: [Symbol, ActiveSupport::HashWithIndifferentAccess, Date, Time, URI::Generic])+ .tap { |maybe_hash| normalize_hash!(maybe_hash) if maybe_hash.is_a?(Hash) }elsif value != '' && !value.nil?read_formatted_setting(value, definition.format)else@@ -334,6 +334,11 @@ class Setting < ApplicationRecordendend+ def self.normalize_hash!(hash)+ hash.deep_stringify_keys!+ hash.deep_transform_values! { |v| v.is_a?(URI::Generic) ? v.to_s : v }+ end+def self.read_formatted_setting(value, format)case formatwhen :booleandiff --git a/docs/installation-and-operations/misc/migration/README.md b/docs/installation-and-operations/misc/migration/README.mdindex 7d90b755bd3..32a9af638d2 100644--- a/docs/installation-and-operations/misc/migration/README.md+++ b/docs/installation-and-operations/misc/migration/README.md@@ -44,7 +44,7 @@ You can simply look through the installer.dat and change those values you need.**The conf.d folder**-Additional environment, either generated from the wizard or entered by you through `openproject config:set` is written to `/etc/openproject/conf.d/{server,database,other}`. Also look through those and check which contain relevant values for your new installation.+Additional environment, either generated from the wizard or entered by you through `openproject config:set` is written to `/etc/openproject/conf.d/{server,database,other}`. Also look through those and check which contain relevant values for your new installation.### PostgreSQL database@@ -68,7 +68,7 @@ pg_restore -h <dbhost> -u <dbuser> -W --dbname <dbname> --clean postgresql-dump-### Attachments-Your storage path can be shown on the old installation can be shown using the following command:+Your storage path on the old installation can be shown using the following command:```openproject config:get ATTACHMENTS_STORAGE_PATH@@ -83,7 +83,7 @@ Simply extract your attachments dump into that folder with `tar -vxfz <dump>.tarFor repositories, the same approach applies as for the attachments:-Your SVN and Git storage paths can be shown on the old installation can be shown using the following command:+Your SVN and Git storage paths on the old installation can be shown using the following command:```# Subversiondiff --git a/lib/tasks/packager.rake b/lib/tasks/packager.rakeindex 2cec9b56a25..f986680e266 100644--- a/lib/tasks/packager.rake+++ b/lib/tasks/packager.rake@@ -115,11 +115,11 @@ namespace :packager doif svn_path.present?# migrate previous repositories with reposman to managedRake::Task['scm:migrate:managed'].invoke("file://#{svn_path}")- checkout_data['subversion'] = { 'enabled' => 1, 'base_url' => URI.join(base_url, prefix, 'svn') }+ checkout_data['subversion'] = { 'enabled' => 1, 'base_url' => URI.join(base_url, prefix, 'svn').to_s }endif git_path.present?- checkout_data['git'] = { 'enabled' => 1, 'base_url' => URI.join(base_url, prefix, 'git') }+ checkout_data['git'] = { 'enabled' => 1, 'base_url' => URI.join(base_url, prefix, 'git').to_s }endSetting.repository_checkout_data = checkout_datadiff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rbindex 2d38df43781..e62b661ad8e 100644--- a/spec/models/setting_spec.rb+++ b/spec/models/setting_spec.rb@@ -303,6 +303,28 @@ describe Setting, type: :model doendend+ describe 'serialized hash settings with URI::Generic inside it' do+ before do+ setting = described_class.create!(name: 'repository_checkout_data')+ setting.update_columns(+ value: {+ git: { enabled: 1, base_url: URI::Generic.build(scheme: 'https', host: 'git.example.com', path: '/public') },+ subversion: { enabled: 0 }+ }.to_yaml+ )+ end++ it 'deserializes correctly' do+ expected_value = {+ "git" => { "enabled" => 1, "base_url" => "https://git.example.com/public" },+ "subversion" => { "enabled" => 0 }+ }++ expect(described_class.repository_checkout_data).to eq(expected_value)+ expect(described_class.find_by(name: 'repository_checkout_data').value).to eq(expected_value)+ end+ end+describe 'caching' dolet(:cache_key) { described_class.send :cache_key }