Skip to content

Commit

Permalink
When an empty file is uploaded, show an error message but allow the p…
Browse files Browse the repository at this point in the history
…ackage to still be uploaded without it.

Closes #975
  • Loading branch information
laurenwalker committed Jun 26, 2019
1 parent 7478271 commit e7e157e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/js/views/DataItemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,23 @@ define(['underscore', 'jquery', 'backbone', 'models/DataONEObject',
// Read each file, and make a DataONEObject
_.each(fileList, function(file) {

var uploadStatus = "l",
errorMessage = "";

if( file.size == 0 ){
uploadStatus = "e";
errorMessage = "This is an empty file. It won't be included in the dataset.";
}

var dataONEObject = new DataONEObject({
synced: true,
type: "Data",
fileName: file.name,
size: file.size,
mediaType: file.type,
uploadFile: file,
uploadStatus: "l",
uploadStatus: uploadStatus,
errorMessage: errorMessage,
isDocumentedBy: [this.parentSciMeta.id],
resourceMap: [this.collection.packageModel.id]
});
Expand Down

0 comments on commit e7e157e

Please sign in to comment.