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
Jérome Perrin
gitlab-ce
Commits
12735eef
Commit
12735eef
authored
Apr 24, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor style adjustments
parent
ea8e86da
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
28 deletions
+45
-28
app/validators/dynamic_path_validator.rb
app/validators/dynamic_path_validator.rb
+39
-21
lib/constraints/project_url_constrainer.rb
lib/constraints/project_url_constrainer.rb
+1
-3
lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
...base/rename_reserved_paths_migration/rename_namespaces.rb
+4
-3
lib/gitlab/etag_caching/router.rb
lib/gitlab/etag_caching/router.rb
+1
-1
No files found.
app/validators/dynamic_path_validator.rb
View file @
12735eef
...
@@ -16,20 +16,33 @@ class DynamicPathValidator < ActiveModel::EachValidator
...
@@ -16,20 +16,33 @@ class DynamicPathValidator < ActiveModel::EachValidator
# the path `api` shouldn't be allowed because it would be masked by `api/*`
# the path `api` shouldn't be allowed because it would be masked by `api/*`
#
#
TOP_LEVEL_ROUTES
=
Set
.
new
(
%w[
TOP_LEVEL_ROUTES
=
Set
.
new
(
%w[
-
.well-known
.well-known
abuse_reports
admin
admin
all
all
api
assets
assets
autocomplete
ci
ci
dashboard
dashboard
explore
files
files
groups
groups
health_check
help
help
hooks
hooks
import
invites
issues
issues
jwt
koding
member
merge_requests
merge_requests
new
new
notes
notes
notification_settings
oauth
profile
profile
projects
projects
public
public
...
@@ -37,29 +50,14 @@ class DynamicPathValidator < ActiveModel::EachValidator
...
@@ -37,29 +50,14 @@ class DynamicPathValidator < ActiveModel::EachValidator
robots.txt
robots.txt
s
s
search
search
sent_notifications
services
services
snippets
snippets
teams
teams
u
u
unsubscribes
unsubscribes
users
api
autocomplete
search
member
explore
uploads
uploads
import
users
notification_settings
abuse_reports
invites
help
koding
health_check
jwt
oauth
sent_notifications
-
]
).
freeze
]
).
freeze
# All project routes with wildcard argument must be listed here.
# All project routes with wildcard argument must be listed here.
...
@@ -71,10 +69,30 @@ class DynamicPathValidator < ActiveModel::EachValidator
...
@@ -71,10 +69,30 @@ class DynamicPathValidator < ActiveModel::EachValidator
# without tree as reserved name routing can match 'group/project' as group name,
# without tree as reserved name routing can match 'group/project' as group name,
# 'tree' as project name and 'deploy_keys' as route.
# 'tree' as project name and 'deploy_keys' as route.
#
#
WILDCARD_ROUTES
=
Set
.
new
(
%w[tree commits wikis new edit create update logs_tree
WILDCARD_ROUTES
=
Set
.
new
(
%w[
preview blob blame raw files create_dir find_file
artifacts
artifacts graphs refs badges info/lfs/objects
badges
gitlab-lfs/objects environments/folders]
)
blame
blob
commits
create
create_dir
edit
environments/folders
files
find_file
gitlab-lfs/objects
graphs
info/lfs/objects
logs_tree
new
preview
raw
refs
tree
update
wikis
]
).
freeze
STRICT_RESERVED
=
(
TOP_LEVEL_ROUTES
|
WILDCARD_ROUTES
).
freeze
STRICT_RESERVED
=
(
TOP_LEVEL_ROUTES
|
WILDCARD_ROUTES
).
freeze
...
...
lib/constraints/project_url_constrainer.rb
View file @
12735eef
...
@@ -4,9 +4,7 @@ class ProjectUrlConstrainer
...
@@ -4,9 +4,7 @@ class ProjectUrlConstrainer
project_path
=
request
.
params
[
:project_id
]
||
request
.
params
[
:id
]
project_path
=
request
.
params
[
:project_id
]
||
request
.
params
[
:id
]
full_path
=
namespace_path
+
'/'
+
project_path
full_path
=
namespace_path
+
'/'
+
project_path
unless
DynamicPathValidator
.
valid?
(
full_path
)
return
false
unless
DynamicPathValidator
.
valid?
(
full_path
)
return
false
end
Project
.
find_by_full_path
(
full_path
).
present?
Project
.
find_by_full_path
(
full_path
).
present?
end
end
...
...
lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
View file @
12735eef
...
@@ -11,9 +11,10 @@ module Gitlab
...
@@ -11,9 +11,10 @@ module Gitlab
end
end
def
namespaces_for_paths
(
type
:)
def
namespaces_for_paths
(
type
:)
namespaces
=
if
type
==
:wildcard
namespaces
=
case
type
when
:wildcard
MigrationClasses
::
Namespace
.
where
.
not
(
parent_id:
nil
)
MigrationClasses
::
Namespace
.
where
.
not
(
parent_id:
nil
)
elsif
type
==
:top_level
when
:top_level
MigrationClasses
::
Namespace
.
where
(
parent_id:
nil
)
MigrationClasses
::
Namespace
.
where
(
parent_id:
nil
)
end
end
with_paths
=
MigrationClasses
::
Route
.
arel_table
[
:path
].
with_paths
=
MigrationClasses
::
Route
.
arel_table
[
:path
].
...
...
lib/gitlab/etag_caching/router.rb
View file @
12735eef
...
@@ -8,7 +8,7 @@ module Gitlab
...
@@ -8,7 +8,7 @@ module Gitlab
# regex itself)
# regex itself)
# - Ending in `noteable/issue/<id>/notes` for the `issue_notes` route
# - Ending in `noteable/issue/<id>/notes` for the `issue_notes` route
# - Ending in `issues/id`/rendered_title` for the `issue_title` route
# - Ending in `issues/id`/rendered_title` for the `issue_title` route
USED_IN_ROUTES
=
%w[noteable issue notes issues render
r
ed_title
USED_IN_ROUTES
=
%w[noteable issue notes issues rendered_title
commit pipelines merge_requests new]
.
freeze
commit pipelines merge_requests new]
.
freeze
RESERVED_WORDS
=
DynamicPathValidator
::
WILDCARD_ROUTES
-
USED_IN_ROUTES
RESERVED_WORDS
=
DynamicPathValidator
::
WILDCARD_ROUTES
-
USED_IN_ROUTES
RESERVED_WORDS_REGEX
=
Regexp
.
union
(
*
RESERVED_WORDS
)
RESERVED_WORDS_REGEX
=
Regexp
.
union
(
*
RESERVED_WORDS
)
...
...
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