diff --git a/js/components/ascribe_uploader/file_drag_and_drop.js b/js/components/ascribe_uploader/file_drag_and_drop.js
index 5879a2ef..28c87677 100644
--- a/js/components/ascribe_uploader/file_drag_and_drop.js
+++ b/js/components/ascribe_uploader/file_drag_and_drop.js
@@ -133,7 +133,7 @@ let FileDragAndDrop = React.createClass({
render: function () {
// has files only is true if there are files that do not have the status deleted or canceled
- let hasFiles = this.props.filesToUpload.filter((file) => file.status !== 'deleted' && file.status !== 'canceled').length > 0;
+ let hasFiles = this.props.filesToUpload.filter((file) => file.status !== 'deleted' && file.status !== 'canceled' && file.size !== -1).length > 0;
let className = hasFiles ? 'has-files ' : '';
className += this.props.dropzoneInactive ? 'inactive-dropzone' : 'active-dropzone';
className += this.props.className ? ' ' + this.props.className : '';
diff --git a/js/components/ascribe_uploader/file_drag_and_drop_preview_iterator.js b/js/components/ascribe_uploader/file_drag_and_drop_preview_iterator.js
index 8d8171ff..896d9f1f 100644
--- a/js/components/ascribe_uploader/file_drag_and_drop_preview_iterator.js
+++ b/js/components/ascribe_uploader/file_drag_and_drop_preview_iterator.js
@@ -19,7 +19,7 @@ let FileDragAndDropPreviewIterator = React.createClass({
return (
{this.props.files.map((file, i) => {
- if(file.status !== 'deleted' && file.status !== 'canceled') {
+ if(file.status !== 'deleted' && file.status !== 'canceled' && file.size !== -1) {
return (
this.onDeleteComplete(fileToDelete.id, null, false))
@@ -417,7 +420,7 @@ var ReactS3FineUploader = React.createClass({
},
handleUploadFile(files) {
-
+ console.log(this.state.files);
// If multiple set and user already uploaded its work,
// cancel upload
if(!this.props.multiple && this.state.filesToUpload.filter((file) => file.status !== 'deleted' && file.status !== 'canceled').length > 0) {
@@ -512,7 +515,7 @@ var ReactS3FineUploader = React.createClass({
handleResumeFile={this.handleResumeFile}
multiple={this.props.multiple}
areAssetsDownloadable={this.props.areAssetsDownloadable}
- dropzoneInactive={!this.props.multiple && this.state.filesToUpload.filter((file) => file.status !== 'deleted' && file.status !== 'canceled').length > 0} />
+ dropzoneInactive={!this.props.multiple && this.state.filesToUpload.filter((file) => file.status !== 'deleted' && file.status !== 'canceled' && file.size !== -1).length > 0} />
);
}
diff --git a/js/utils/requests.js b/js/utils/requests.js
index e10a8a99..7e42dfee 100644
--- a/js/utils/requests.js
+++ b/js/utils/requests.js
@@ -27,6 +27,17 @@ class Requests {
return response.text();
}
+ customJSONparse(responseText) {
+ // If the responses' body does not contain any data,
+ // fetch will resolve responseText to the string 'None'.
+ // If this is the case, we can not try to parse it as JSON.
+ if(responseText !== 'None') {
+ return JSON.parse(responseText);
+ } else {
+ return {};
+ }
+ }
+
handleFatalError(err) {
this.fatalErrorHandler(err);
throw new ServerError(err);
@@ -36,6 +47,7 @@ class Requests {
if (!json.success) {
let error = new APIError();
error.json = json;
+ console.error(new Error('The \'success\' property is missing in the server\'s response.'));
throw error;
}
return json;
@@ -83,7 +95,7 @@ class Requests {
merged.method = verb;
return fetch(url, merged)
.then(this.unpackResponse)
- .then(JSON.parse)
+ .then(this.customJSONparse)
.catch(this.handleFatalError.bind(this))
.then(this.handleAPIError);
}
diff --git a/sass/main.scss b/sass/main.scss
index 681e5149..d8d5345e 100644
--- a/sass/main.scss
+++ b/sass/main.scss
@@ -244,5 +244,5 @@ body {
}
.ascribe-button-list button {
- margin-right: 1em;
+ margin-right: 1px;
}
\ No newline at end of file