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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
fbb5a359
Commit
fbb5a359
authored
Apr 27, 2015
by
Jeroen van Baarsen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8754 from jirutka/fix-project_name_regex
Fix (project_)name_regex to accept non-ASCII letters and dash
parents
c1a5f471
a1c01bc1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+4
-4
spec/lib/gitlab/regex_spec.rb
spec/lib/gitlab/regex_spec.rb
+3
-0
No files found.
CHANGELOG
View file @
fbb5a359
...
@@ -25,6 +25,7 @@ v 7.11.0 (unreleased)
...
@@ -25,6 +25,7 @@ v 7.11.0 (unreleased)
- Prevent sending empty messages to HipChat (Chulki Lee)
- Prevent sending empty messages to HipChat (Chulki Lee)
- Improve UI for mobile phones on dashboard and project pages
- Improve UI for mobile phones on dashboard and project pages
- Add room notification and message color option for HipChat
- Add room notification and message color option for HipChat
- Allow to use non-ASCII letters and dashes in project and namespace name. (Jakub Jirutka)
v 7.10.0
v 7.10.0
- Ignore submodules that are defined in .gitmodules but are checked in as directories.
- Ignore submodules that are defined in .gitmodules but are checked in as directories.
...
...
lib/gitlab/regex.rb
View file @
fbb5a359
...
@@ -15,20 +15,20 @@ module Gitlab
...
@@ -15,20 +15,20 @@ module Gitlab
def
namespace_name_regex
def
namespace_name_regex
@namespace_name_regex
||=
/\A[
a-zA-Z0-9_\-
\. ]*\z/
.
freeze
@namespace_name_regex
||=
/\A[
\p{Alnum}\p{Pd}_
\. ]*\z/
.
freeze
end
end
def
namespace_name_regex_message
def
namespace_name_regex_message
"can contain only letters, digits, '_', '
-', '.'
and space."
"can contain only letters, digits, '_', '
.', dash
and space."
end
end
def
project_name_regex
def
project_name_regex
@project_name_regex
||=
/\A[
a-zA-Z0-9_.][a-zA-Z0-9_\-
\. ]*\z/
.
freeze
@project_name_regex
||=
/\A[
\p{Alnum}_][\p{Alnum}\p{Pd}_
\. ]*\z/
.
freeze
end
end
def
project_name_regex_message
def
project_name_regex_message
"can contain only letters, digits, '_', '
-', '.'
and space. "
\
"can contain only letters, digits, '_', '
.', dash
and space. "
\
"It must start with letter, digit or '_'."
"It must start with letter, digit or '_'."
end
end
...
...
spec/lib/gitlab/regex_spec.rb
View file @
fbb5a359
# coding: utf-8
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
Regex
do
describe
Gitlab
::
Regex
do
...
@@ -16,6 +17,8 @@ describe Gitlab::Regex do
...
@@ -16,6 +17,8 @@ describe Gitlab::Regex do
it
{
expect
(
'GitLab CE'
).
to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
it
{
expect
(
'GitLab CE'
).
to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
it
{
expect
(
'100 lines'
).
to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
it
{
expect
(
'100 lines'
).
to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
it
{
expect
(
'gitlab.git'
).
to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
it
{
expect
(
'gitlab.git'
).
to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
it
{
expect
(
'Český název'
).
to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
it
{
expect
(
'Dash – is this'
).
to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
it
{
expect
(
'?gitlab'
).
not_to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
it
{
expect
(
'?gitlab'
).
not_to
match
(
Gitlab
::
Regex
.
project_name_regex
)
}
end
end
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