Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
46f8dececd76
Commit
46f8dece
authored
Feb 09, 2015
by
Jakub Jirutka
Browse files
Fix (project_)name_regex to accept non-ASCII letters and dash
parent
4605bee1f09a
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
46f8dece
...
...
@@ -26,6 +26,7 @@
- Prevent sending empty messages to HipChat (Chulki Lee)
- Improve UI for mobile phones on dashboard and project pages
- 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
- Ignore submodules that are defined in .gitmodules but are checked in as directories.
...
...
lib/gitlab/regex.rb
View file @
46f8dece
...
...
@@ -15,7 +15,7 @@
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
def
namespace_name_regex_message
...
...
@@ -19,8 +19,8 @@
end
def
namespace_name_regex_message
"can contain only letters, digits, '_', '
-
',
'.'
and space."
"can contain only letters, digits, '_', '
.
',
dash
and space."
end
def
project_name_regex
...
...
@@ -23,8 +23,8 @@
end
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
def
project_name_regex_message
...
...
@@ -28,7 +28,7 @@
end
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 '_'."
end
...
...
spec/lib/gitlab/regex_spec.rb
View file @
46f8dece
# coding: utf-8
require
'spec_helper'
describe
Gitlab
::
Regex
do
...
...
@@ -16,6 +17,8 @@
it
{
expect
(
'GitLab CE'
).
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
(
'Č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
)
}
end
end
Write
Preview
Supports
Markdown
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