Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
c5059cb4
Commit
c5059cb4
authored
Apr 14, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make path validation case-insensitive
parent
27f54beb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
app/validators/dynamic_path_validator.rb
app/validators/dynamic_path_validator.rb
+1
-0
spec/validators/dynamic_path_validator_spec.rb
spec/validators/dynamic_path_validator_spec.rb
+7
-1
No files found.
app/validators/dynamic_path_validator.rb
View file @
c5059cb4
...
@@ -94,6 +94,7 @@ class DynamicPathValidator < ActiveModel::EachValidator
...
@@ -94,6 +94,7 @@ class DynamicPathValidator < ActiveModel::EachValidator
end
end
def
self
.
reserved?
(
value
,
type: :strict
)
def
self
.
reserved?
(
value
,
type: :strict
)
value
=
value
.
to_s
.
downcase
case
type
case
type
when
:wildcard
when
:wildcard
WILDCARD_ROUTES
.
include?
(
value
)
WILDCARD_ROUTES
.
include?
(
value
)
...
...
spec/validators/dynamic_path_validator_spec.rb
View file @
c5059cb4
...
@@ -81,7 +81,13 @@ describe DynamicPathValidator do
...
@@ -81,7 +81,13 @@ describe DynamicPathValidator do
end
end
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
it
"isn't valid when the top level is reserved"
do
test_path
=
'u/should-be-a/reserved-word'
test_path
=
'u/should-be-a/reserved-word'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment