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
a089f8a3
Commit
a089f8a3
authored
Sep 23, 2020
by
Sushil khanchi
Committed by
Markus Koller
Sep 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Designs: return an error if uploading designs with duplicate names
parent
ac31fd07
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
app/services/design_management/save_designs_service.rb
app/services/design_management/save_designs_service.rb
+1
-0
changelogs/unreleased/khanchi-designs-patch.yml
changelogs/unreleased/khanchi-designs-patch.yml
+5
-0
spec/services/design_management/save_designs_service_spec.rb
spec/services/design_management/save_designs_service_spec.rb
+8
-0
No files found.
app/services/design_management/save_designs_service.rb
View file @
a089f8a3
...
...
@@ -16,6 +16,7 @@ module DesignManagement
def
execute
return
error
(
"Not allowed!"
)
unless
can_create_designs?
return
error
(
"Only
#{
MAX_FILES
}
files are allowed simultaneously"
)
if
files
.
size
>
MAX_FILES
return
error
(
"Duplicate filenames are not allowed!"
)
if
files
.
map
(
&
:original_filename
).
uniq
.
length
!=
files
.
length
uploaded_designs
,
version
=
upload_designs!
skipped_designs
=
designs
-
uploaded_designs
...
...
changelogs/unreleased/khanchi-designs-patch.yml
0 → 100644
View file @
a089f8a3
---
title
:
'
Designs:
return
an
error
if
uploading
designs
with
duplicate
names'
merge_request
:
42514
author
:
Sushil Khanchi
type
:
fixed
spec/services/design_management/save_designs_service_spec.rb
View file @
a089f8a3
...
...
@@ -271,6 +271,14 @@ RSpec.describe DesignManagement::SaveDesignsService do
expect
(
response
[
:message
]).
to
match
(
/only \d+ files are allowed simultaneously/i
)
end
end
context
'when uploading duplicate files'
do
let
(
:files
)
{
[
rails_sample
,
dk_png
,
rails_sample
]
}
it
'returns the correct error'
do
expect
(
response
[
:message
]).
to
match
(
'Duplicate filenames are not allowed!'
)
end
end
end
context
'when the user is not allowed to upload designs'
do
...
...
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