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
Boxiang Sun
gitlab-ce
Commits
c2d1fbe5
Commit
c2d1fbe5
authored
Jul 23, 2019
by
Giorgenes Gelatti
Committed by
Nathan Friend
Jul 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validates tag names and tags#bulk_destroy
parent
786133d3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
app/controllers/projects/registry/tags_controller.rb
app/controllers/projects/registry/tags_controller.rb
+9
-0
lib/container_registry/tag.rb
lib/container_registry/tag.rb
+7
-0
No files found.
app/controllers/projects/registry/tags_controller.rb
View file @
c2d1fbe5
...
...
@@ -29,7 +29,16 @@ module Projects
end
def
bulk_destroy
unless
params
[
:ids
].
present?
head
:bad_request
return
end
@tags
=
(
params
[
:ids
]
||
[]).
map
{
|
tag_name
|
image
.
tag
(
tag_name
)
}
unless
@tags
.
all?
{
|
tag
|
tag
.
valid_name?
}
head
:bad_request
return
end
success_count
=
0
@tags
.
each
do
|
tag
|
...
...
lib/container_registry/tag.rb
View file @
c2d1fbe5
...
...
@@ -6,6 +6,9 @@ module ContainerRegistry
attr_reader
:repository
,
:name
# https://github.com/docker/distribution/commit/3150937b9f2b1b5b096b2634d0e7c44d4a0f89fb
TAG_NAME_REGEX
=
/^[\w][\w.-]{0,127}$/
.
freeze
delegate
:registry
,
:client
,
to: :repository
delegate
:revision
,
:short_revision
,
to: :config_blob
,
allow_nil:
true
...
...
@@ -13,6 +16,10 @@ module ContainerRegistry
@repository
,
@name
=
repository
,
name
end
def
valid_name?
!
name
.
match
(
TAG_NAME_REGEX
).
nil?
end
def
valid?
manifest
.
present?
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