AMBARI-22490. Uploading a Zero KB file to HDFS via File View Fails (pallavkul)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ff08592a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ff08592a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ff08592a Branch: refs/heads/branch-3.0-perf Commit: ff08592a32d3b8bf4c2ba2c674b73233c775f424 Parents: ca174fb Author: pallavkul <[email protected]> Authored: Thu Nov 30 07:16:47 2017 +0530 Committer: pallavkul <[email protected]> Committed: Thu Nov 30 07:16:47 2017 +0530 ---------------------------------------------------------------------- .../resources/ui/app/components/upload-file.js | 38 ++++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ff08592a/contrib/views/files/src/main/resources/ui/app/components/upload-file.js ---------------------------------------------------------------------- diff --git a/contrib/views/files/src/main/resources/ui/app/components/upload-file.js b/contrib/views/files/src/main/resources/ui/app/components/upload-file.js index 8a14272..1a5e911 100644 --- a/contrib/views/files/src/main/resources/ui/app/components/upload-file.js +++ b/contrib/views/files/src/main/resources/ui/app/components/upload-file.js @@ -104,25 +104,25 @@ export default Ember.Component.extend(OperationModal, { url: url }); this.set('uploader', uploader); - if(!Ember.isEmpty(file)) { - uploader.upload(file, {path: this.get('path')}); - this.setUploading(file.name); - uploader.on('progress', (e) => { - this.setUploadPercent(e.percent); - }); - uploader.on('didUpload', (e) => { - this.set('uploader'); - this.send('close'); - this.sendAction('refreshAction'); - }); - uploader.on('didError', (jqXHR, textStatus, errorThrown) => { - var error = Ember.$.parseJSON(jqXHR.responseText); - this.set('uploader'); - this.get('logger').danger(`Failed to upload ${file.name} to ${this.get('path')}`, error); - this.send('close'); - return false; - }); - } + uploader.upload(file, { + path: this.get('path') + }); + this.setUploading(file.name); + uploader.on('progress', (e) => { + this.setUploadPercent(e.percent); + }); + uploader.on('didUpload', (e) => { + this.set('uploader'); + this.send('close'); + this.sendAction('refreshAction'); + }); + uploader.on('didError', (jqXHR, textStatus, errorThrown) => { + var error = Ember.$.parseJSON(jqXHR.responseText); + this.set('uploader'); + this.get('logger').danger(`Failed to upload ${file.name} to ${this.get('path')}`, error); + this.send('close'); + return false; + }); }, (error) => { console.error("Cannot add a directory.", error); this.send('close');
