summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/validators/dynamic_path_validator.rb1
-rw-r--r--spec/validators/dynamic_path_validator_spec.rb8
2 files changed, 8 insertions, 1 deletions
diff --git a/app/validators/dynamic_path_validator.rb b/app/validators/dynamic_path_validator.rb
index 7587a3f20e1..3b93a0d0b28 100644
--- a/app/validators/dynamic_path_validator.rb
+++ b/app/validators/dynamic_path_validator.rb
@@ -94,6 +94,7 @@ class DynamicPathValidator < ActiveModel::EachValidator
end
def self.reserved?(value, type: :strict)
+ value = value.to_s.downcase
case type
when :wildcard
WILDCARD_ROUTES.include?(value)
diff --git a/spec/validators/dynamic_path_validator_spec.rb b/spec/validators/dynamic_path_validator_spec.rb
index 6c490b1be2e..b931a4a2dc3 100644
--- a/spec/validators/dynamic_path_validator_spec.rb
+++ b/spec/validators/dynamic_path_validator_spec.rb
@@ -81,7 +81,13 @@ describe DynamicPathValidator do
end
end
- describe '#valid_full_path' do
+ describe ".valid?" do
+ it 'is not case sensitive' do
+ expect(described_class.valid?("Users", type: :top_level)).to be(false)
+ end
+ end
+
+ describe '.valid_full_path' do
it "isn't valid when the top level is reserved" do
test_path = 'u/should-be-a/reserved-word'