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
Boxiang Sun
gitlab-ce
Commits
29f20011
Commit
29f20011
authored
May 02, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update comments
parent
e2b9420c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
+26
-5
app/validators/dynamic_path_validator.rb
app/validators/dynamic_path_validator.rb
+18
-5
lib/gitlab/database/rename_reserved_paths_migration/v1.rb
lib/gitlab/database/rename_reserved_paths_migration/v1.rb
+8
-0
No files found.
app/validators/dynamic_path_validator.rb
View file @
29f20011
...
@@ -61,15 +61,28 @@ class DynamicPathValidator < ActiveModel::EachValidator
...
@@ -61,15 +61,28 @@ class DynamicPathValidator < ActiveModel::EachValidator
users
users
]
.
freeze
]
.
freeze
#
All project routes with wildcard argument must be listed here.
#
This list should contain all words following `/*namespace_id/:project_id` in
#
Otherwise it can lead to routing issues when route considered as project name
.
#
routes that contain a second wildcard
.
#
#
# Example:
# Example:
#
/group/project/tree/deploy_keys
#
/*namespace_id/:project_id/badges/*ref/build
#
#
#
without tree as reserved name routing can match 'group/project' as group name,
#
If `badges` was allowed as a project/group name, we would not be able to access the
#
'tree' as project name and 'deploy_keys' as route.
#
`badges` route for those projects:
#
#
# Consider a namespace with path `foo/bar` and a project called `badges`.
# The route to the build badge would then be `/foo/bar/badges/badges/master/build.svg`
#
# When accessing this path the route would be matched to the `badges` path
# with the following params:
# - namespace_id: `foo`
# - project_id: `bar`
# - ref: `badges/master`
#
# Failing to find the project, this would result in a 404.
#
# By rejecting `badges` the router can _count_ on the fact that `badges` will
# be preceded by the `namespace/project`.
WILDCARD_ROUTES
=
%w[
WILDCARD_ROUTES
=
%w[
badges
badges
blame
blame
...
...
lib/gitlab/database/rename_reserved_paths_migration/v1.rb
View file @
29f20011
# This module can be included in migrations to make it easier to rename paths
# of `Namespace` & `Project` models certain paths would become `reserved`.
#
# If the way things are stored on the filesystem related to namespaces and
# projects ever changes. Don't update this module, or anything nested in `V1`,
# since it needs to keep functioning for all migrations using it using the state
# that the data is in at the time. Instead, create a `V2` module that implements
# the new way of reserving paths.
module
Gitlab
module
Gitlab
module
Database
module
Database
module
RenameReservedPathsMigration
module
RenameReservedPathsMigration
...
...
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