diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.spec.ts b/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.spec.ts index 0d38cee01f..f117f261b3 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.spec.ts +++ b/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.spec.ts @@ -65,26 +65,6 @@ describe('UploadDragAreaComponent', () => { TestBed.resetTestingModule(); }); - it('should show an folder non supported error in console when the file type is empty', () => { - component.showNotificationBar = false; - spyOn(logService, 'error'); - - let fileFake = new File([''], 'folder-fake', {type: ''}); - component.onFilesDropped([fileFake]); - - expect(logService.error).toHaveBeenCalledWith('FILE_UPLOAD.MESSAGES.FOLDER_NOT_SUPPORTED'); - }); - - it('should show an folder non supported error in the notification bar when the file type is empty', () => { - component.showErrorNotificationBar = jasmine.createSpy('_showErrorNotificationBar'); - component.showNotificationBar = true; - - let fileFake = new File([''], 'folder-fake', {type: ''}); - component.onFilesDropped([fileFake]); - - expect(component.showErrorNotificationBar).toHaveBeenCalledWith('FILE_UPLOAD.MESSAGES.FOLDER_NOT_SUPPORTED'); - }); - it('should upload the list of files dropped', () => { component.currentFolderPath = '/root-fake-/sites-fake/folder-fake'; component.onSuccess = null; diff --git a/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.ts b/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.ts index 70763a0ee8..f46b7957f7 100644 --- a/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.ts +++ b/ng2-components/ng2-alfresco-upload/src/components/upload-drag-area.component.ts @@ -97,37 +97,15 @@ export class UploadDragAreaComponent { */ onFilesDropped(files: File[], rootId?: string, directory?: string): void { if (files.length) { - if (this.checkValidity(files)) { - this.uploadService.addToQueue(files); - this.uploadService.uploadFilesInTheQueue(rootId || this.rootFolderId, directory || this.currentFolderPath, this.onSuccess); - let latestFilesAdded = this.uploadService.getQueue(); - if (this.showNotificationBar) { - this.showUndoNotificationBar(latestFilesAdded); - } - } else { - let errorMessage: any; - errorMessage = this.translateService.get('FILE_UPLOAD.MESSAGES.FOLDER_NOT_SUPPORTED'); - if (this.showNotificationBar) { - this.showErrorNotificationBar(errorMessage.value); - } else { - this.logService.error(errorMessage.value); - } + this.uploadService.addToQueue(files); + this.uploadService.uploadFilesInTheQueue(rootId || this.rootFolderId, directory || this.currentFolderPath, this.onSuccess); + let latestFilesAdded = this.uploadService.getQueue(); + if (this.showNotificationBar) { + this.showUndoNotificationBar(latestFilesAdded); } } } - /** - * Check il the file is valid or not - * @param files - * @returns {boolean} - */ - checkValidity(files: File[]): boolean { - if (files.length && files[0].type === '') { - return false; - } - return true; - } - /** * Called when the file are dropped in the drag area * @param item - FileEntity