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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
17ea019f
Commit
17ea019f
authored
Dec 26, 2012
by
Andrey Kumanyaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Project name validation
parent
c4536ae5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
app/models/project.rb
app/models/project.rb
+3
-1
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+4
-0
No files found.
app/models/project.rb
View file @
17ea019f
...
@@ -64,7 +64,9 @@ class Project < ActiveRecord::Base
...
@@ -64,7 +64,9 @@ class Project < ActiveRecord::Base
# Validations
# Validations
validates
:owner
,
presence:
true
validates
:owner
,
presence:
true
validates
:description
,
length:
{
within:
0
..
2000
}
validates
:description
,
length:
{
within:
0
..
2000
}
validates
:name
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:name
,
presence:
true
,
length:
{
within:
0
..
255
},
format:
{
with:
Gitlab
::
Regex
.
project_name_regex
,
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
validates
:path
,
presence:
true
,
length:
{
within:
0
..
255
},
validates
:path
,
presence:
true
,
length:
{
within:
0
..
255
},
format:
{
with:
Gitlab
::
Regex
.
path_regex
,
format:
{
with:
Gitlab
::
Regex
.
path_regex
,
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
...
...
lib/gitlab/regex.rb
View file @
17ea019f
...
@@ -6,6 +6,10 @@ module Gitlab
...
@@ -6,6 +6,10 @@ module Gitlab
default_regex
default_regex
end
end
def
project_name_regex
default_regex
end
def
path_regex
def
path_regex
default_regex
default_regex
end
end
...
...
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