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
d2161350
Commit
d2161350
authored
Sep 05, 2018
by
Chantal Rollison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handled exception during file upload
parent
c691e07a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
app/controllers/concerns/uploads_actions.rb
app/controllers/concerns/uploads_actions.rb
+2
-0
changelogs/unreleased/ccr-6699_image_for_object_error.yml
changelogs/unreleased/ccr-6699_image_for_object_error.yml
+6
-0
spec/controllers/projects/uploads_controller_spec.rb
spec/controllers/projects/uploads_controller_spec.rb
+14
-0
No files found.
app/controllers/concerns/uploads_actions.rb
View file @
d2161350
...
@@ -53,6 +53,8 @@ module UploadsActions
...
@@ -53,6 +53,8 @@ module UploadsActions
maximum_size:
Gitlab
::
CurrentSettings
.
max_attachment_size
.
megabytes
.
to_i
)
maximum_size:
Gitlab
::
CurrentSettings
.
max_attachment_size
.
megabytes
.
to_i
)
render
json:
authorized
render
json:
authorized
rescue
SocketError
render
json:
"Error uploading file"
,
status: :internal_server_error
end
end
private
private
...
...
changelogs/unreleased/ccr-6699_image_for_object_error.yml
0 → 100644
View file @
d2161350
---
title
:
Handles exception during file upload - replaces the stack trace with a small
error message.
merge_request
:
21528
author
:
type
:
fixed
spec/controllers/projects/uploads_controller_spec.rb
View file @
d2161350
...
@@ -18,6 +18,20 @@ describe Projects::UploadsController do
...
@@ -18,6 +18,20 @@ describe Projects::UploadsController do
end
end
end
end
context
"when exception occurs"
do
before
do
allow
(
FileUploader
).
to
receive
(
:workhorse_authorize
).
and_raise
(
SocketError
.
new
)
sign_in
(
create
(
:user
))
end
it
"responds with status internal_server_error"
do
post_authorize
expect
(
response
).
to
have_gitlab_http_status
(
500
)
expect
(
response
.
body
).
to
eq
(
'Error uploading file'
)
end
end
def
post_authorize
(
verified:
true
)
def
post_authorize
(
verified:
true
)
request
.
headers
.
merge!
(
workhorse_internal_api_request_header
)
if
verified
request
.
headers
.
merge!
(
workhorse_internal_api_request_header
)
if
verified
...
...
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