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
Léo-Paul Géneau
gitlab-ce
Commits
5f93b0e3
Commit
5f93b0e3
authored
Mar 24, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't allow username to end in period.
parent
dfe0f9ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
4 deletions
+47
-4
CHANGELOG
CHANGELOG
+2
-0
app/models/namespace.rb
app/models/namespace.rb
+1
-1
db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb
...ate/20150324133047_remove_periods_at_ends_of_usernames.rb
+39
-0
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+1
-1
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+4
-2
No files found.
CHANGELOG
View file @
5f93b0e3
...
...
@@ -46,6 +46,8 @@ v 7.10.0 (unreleased)
- Refactor issue filtering
- AJAX selectbox for issue assignee and author filters
- Fix issue with missing options in issue filtering dropdown if selected one
- Fix "Hello @username." references not working by no longer allowing usernames to end in period.
v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted.
...
...
app/models/namespace.rb
View file @
5f93b0e3
...
...
@@ -66,7 +66,7 @@ class Namespace < ActiveRecord::Base
path
.
gsub!
(
/@.*\z/
,
""
)
path
.
gsub!
(
/\.git\z/
,
""
)
path
.
gsub!
(
/\A-/
,
""
)
path
.
gsub!
(
/
\z.
/
,
""
)
path
.
gsub!
(
/
.\z
/
,
""
)
path
.
gsub!
(
/[^a-zA-Z0-9_\-\.]/
,
""
)
counter
=
0
...
...
db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb
0 → 100644
View file @
5f93b0e3
class
RemovePeriodsAtEndsOfUsernames
<
ActiveRecord
::
Migration
class
Namespace
<
ActiveRecord
::
Base
class
<<
self
def
by_path
(
path
)
where
(
'lower(path) = :value'
,
value:
path
.
downcase
).
first
end
def
clean_path
(
path
)
path
.
gsub!
(
/@.*\z/
,
""
)
path
.
gsub!
(
/\.git\z/
,
""
)
path
.
gsub!
(
/\A-/
,
""
)
path
.
gsub!
(
/.\z/
,
""
)
path
.
gsub!
(
/[^a-zA-Z0-9_\-\.]/
,
""
)
counter
=
0
base
=
path
while
Namespace
.
by_path
(
path
).
present?
counter
+=
1
path
=
"
#{
base
}#{
counter
}
"
end
path
end
end
end
def
up
select_all
(
"SELECT id, username FROM users WHERE username LIKE '%.'"
).
each
do
|
user
|
username
=
quote_string
(
Namespace
.
clean_path
(
user
[
"username"
]))
execute
"UPDATE users SET username = '
#{
username
}
' WHERE id =
#{
user
[
"id"
]
}
"
execute
"UPDATE namespaces SET path = '
#{
username
}
', name = '
#{
username
}
' WHERE type = NULL AND owner_id =
#{
user
[
"id"
]
}
"
end
select_all
(
"SELECT id, path FROM namespaces WHERE type = 'Group' AND path LIKE '%.'"
).
each
do
|
group
|
path
=
quote_string
(
Namespace
.
clean_path
(
group
[
"path"
]))
execute
"UPDATE namespaces SET path = '
#{
path
}
' WHERE id =
#{
group
[
"id"
]
}
"
end
end
end
lib/gitlab/markdown.rb
View file @
5f93b0e3
...
...
@@ -152,7 +152,7 @@ module Gitlab
text
end
NAME_STR
=
'[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*'
NAME_STR
=
Gitlab
::
Regex
::
NAMESPACE_REGEX_STR
PROJ_STR
=
"(?<project>
#{
NAME_STR
}
/
#{
NAME_STR
}
)"
REFERENCE_PATTERN
=
%r{
...
...
lib/gitlab/regex.rb
View file @
5f93b0e3
...
...
@@ -2,13 +2,15 @@ module Gitlab
module
Regex
extend
self
NAMESPACE_REGEX_STR
=
'(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'
.
freeze
def
namespace_regex
@namespace_regex
||=
/\A
[a-zA-Z0-9_.][a-zA-Z0-9_\-\.]*(?<!\.git)
\z/
.
freeze
@namespace_regex
||=
/\A
#{
NAMESPACE_REGEX_STR
}
\z/
.
freeze
end
def
namespace_regex_message
"can contain only letters, digits, '_', '-' and '.'. "
\
"Cannot start with '-' or end in '.
git'
"
\
"Cannot start with '-' or end in '.
'.
"
\
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