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
03439714
Commit
03439714
authored
Sep 02, 2018
by
Paul Slaughter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error message handling in dropzone_input
parent
46f48166
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
app/assets/javascripts/dropzone_input.js
app/assets/javascripts/dropzone_input.js
+14
-3
No files found.
app/assets/javascripts/dropzone_input.js
View file @
03439714
...
...
@@ -7,6 +7,19 @@ import axios from './lib/utils/axios_utils';
Dropzone
.
autoDiscover
=
false
;
/**
* Return the error message string from the given response.
*
* @param {String|Object} res
*/
function
getErrorMessage
(
res
)
{
if
(
!
res
||
_
.
isString
(
res
))
{
return
res
;
}
return
res
.
message
;
}
export
default
function
dropzoneInput
(
form
)
{
const
divHover
=
'
<div class="div-dropzone-hover"></div>
'
;
const
iconPaperclip
=
'
<i class="fa fa-paperclip div-dropzone-icon"></i>
'
;
...
...
@@ -84,9 +97,7 @@ export default function dropzoneInput(form) {
// xhr object (xhr.responseText is error message).
// On error we hide the 'Attach' and 'Cancel' buttons
// and show an error.
// If there's xhr error message, let's show it instead of dropzone's one.
const
message
=
xhr
?
xhr
.
responseText
:
errorMessage
;
const
message
=
getErrorMessage
(
errorMessage
||
xhr
.
responseText
);
$uploadingErrorContainer
.
removeClass
(
'
hide
'
);
$uploadingErrorMessage
.
html
(
message
);
...
...
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