mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Fix upload folder not supported for Safari and Firefox
This commit is contained in:
@@ -76,15 +76,37 @@ export class UploadDragAreaComponent {
|
||||
*/
|
||||
onFilesDropped(files: File[]): void {
|
||||
if (files.length) {
|
||||
this._uploaderService.addToQueue(files);
|
||||
this._uploaderService.uploadFilesInTheQueue(this.currentFolderPath, this.onSuccess);
|
||||
let latestFilesAdded = this._uploaderService.getQueue();
|
||||
if (this.showUdoNotificationBar) {
|
||||
this._showUndoNotificationBar(latestFilesAdded);
|
||||
if (this.checkValidity(files)) {
|
||||
this._uploaderService.addToQueue(files);
|
||||
this._uploaderService.uploadFilesInTheQueue(this.currentFolderPath, this.onSuccess);
|
||||
let latestFilesAdded = this._uploaderService.getQueue();
|
||||
if (this.showUdoNotificationBar) {
|
||||
this._showUndoNotificationBar(latestFilesAdded);
|
||||
}
|
||||
} else {
|
||||
let errorMessage: any;
|
||||
errorMessage = this.translate.get('FILE_UPLOAD.MESSAGES.FOLDER_NOT_SUPPORTED');
|
||||
if (this.showUdoNotificationBar) {
|
||||
this._showErrorNotificationBar(errorMessage.value);
|
||||
} else {
|
||||
console.error(errorMessage.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -126,10 +148,12 @@ export class UploadDragAreaComponent {
|
||||
error => {
|
||||
let errorMessagePlaceholder = this.getErrorMessage(error.response);
|
||||
let errorMessage = this.formatString(errorMessagePlaceholder, [folder.name]);
|
||||
if (errorMessage) {
|
||||
if (this.showUdoNotificationBar) {
|
||||
this._showErrorNotificationBar(errorMessage);
|
||||
} else {
|
||||
console.error(errorMessage);
|
||||
}
|
||||
console.log(error);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user