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
rescue Addressable::URI::InvalidURIError
Ivan Kuchinb8e7094606ab
diff --git a/app/models/custom_value/link_strategy.rb b/app/models/custom_value/link_strategy.rbindex 091c01de5d6..4c552e06e49 100644--- a/app/models/custom_value/link_strategy.rb+++ b/app/models/custom_value/link_strategy.rb@@ -45,5 +45,7 @@ class CustomValue::LinkStrategy < CustomValue::FormatStrategydef parsed_url(val)Addressable::URI.heuristic_parse(val, scheme: "http")+ rescue Addressable::URI::InvalidURIError+ nilendenddiff --git a/spec/models/custom_value/link_strategy_spec.rb b/spec/models/custom_value/link_strategy_spec.rbindex 5a8c6ee4557..da486161c4b 100644--- a/spec/models/custom_value/link_strategy_spec.rb+++ b/spec/models/custom_value/link_strategy_spec.rb@@ -79,6 +79,12 @@ RSpec.describe CustomValue::LinkStrategy doit { is_expected.to eq "random:hello" }end+ context "when value is just a schema" do+ let(:value) { "https:" }++ it { is_expected.to eq "https:" }+ end+context "when value is a path" dolet(:value) { "/projects" }@@ -149,6 +155,12 @@ RSpec.describe CustomValue::LinkStrategy doit { is_expected.to eq "random:hello" }end+ context "when value is just a schema" do+ let(:value) { "https:" }++ it { is_expected.to eq "https:" }+ end+context "when value is a path" dolet(:value) { "/projects" }@@ -221,6 +233,12 @@ RSpec.describe CustomValue::LinkStrategy doit { is_expected.to eq "random:hello" }end+ context "when value is just a schema" do+ let(:input) { "https:" }++ it { is_expected.to be_nil }+ end+context "when value is a path" dolet(:input) { "/projects" }@@ -291,6 +309,12 @@ RSpec.describe CustomValue::LinkStrategy doit { is_expected.to be_nil }end+ context "when value is just a schema" do+ let(:value) { "https:" }++ it { is_expected.to eq :invalid_url }+ end+context "when value is a path" dolet(:value) { "/projects" }