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
f6a11d00
Commit
f6a11d00
authored
Apr 18, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix duplicated container repository names
parent
f88762a5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
3 deletions
+38
-3
lib/container_registry/path.rb
lib/container_registry/path.rb
+8
-2
spec/lib/container_registry/path_spec.rb
spec/lib/container_registry/path_spec.rb
+30
-1
No files found.
lib/container_registry/path.rb
View file @
f6a11d00
...
...
@@ -48,7 +48,7 @@ module ContainerRegistry
end
def
root_repository?
@path
==
repository_project
.
full
_path
@path
==
project
_path
end
def
repository_project
...
...
@@ -60,7 +60,13 @@ module ContainerRegistry
def
repository_name
return
unless
has_project?
@path
.
remove
(
%r(^
#{
Regexp
.
escape
(
repository_project
.
full_path
)
}
/?)
)
@path
.
remove
(
%r(^
#{
Regexp
.
escape
(
project_path
)
}
/?)
)
end
def
project_path
return
unless
has_project?
repository_project
.
full_path
.
downcase
end
def
to_s
...
...
spec/lib/container_registry/path_spec.rb
View file @
f6a11d00
...
...
@@ -189,7 +189,7 @@ describe ContainerRegistry::Path do
end
context
'when project exists'
do
let
(
:group
)
{
create
(
:group
,
path:
'
some_g
roup'
)
}
let
(
:group
)
{
create
(
:group
,
path:
'
Some_G
roup'
)
}
let
(
:project
)
do
create
(
:empty_project
,
group:
group
,
name:
'some_project'
)
...
...
@@ -225,4 +225,33 @@ describe ContainerRegistry::Path do
end
end
end
describe
'#project_path'
do
context
'when project does not exist'
do
let
(
:path
)
{
'some/name'
}
it
'returns nil'
do
expect
(
subject
.
project_path
).
to
be_nil
end
end
context
'when project with uppercase characters in path exists'
do
let
(
:path
)
{
'somegroup/someproject'
}
let
(
:group
)
{
create
(
:group
,
path:
'SomeGroup'
)
}
let
(
:project
)
do
create
(
:empty_project
,
group:
group
,
name:
'SomeProject'
)
end
before
do
allow
(
path
).
to
receive
(
:repository_project
)
.
and_return
(
project
)
end
it
'returns downcased project path'
do
expect
(
subject
.
project_path
).
to
eq
'somegroup/someproject'
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