mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
various code quality fixes (#5792)
* various code quality fixes * reduce duplicated code * add safety check
This commit is contained in:
@@ -96,7 +96,6 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
||||
/**
|
||||
* Upload a list of file in the specified path
|
||||
* @param files
|
||||
* @param path
|
||||
*/
|
||||
uploadFiles(files: File[]): void {
|
||||
const filteredFiles: FileModel[] = files
|
||||
@@ -152,17 +151,16 @@ export abstract class UploadBase implements OnInit, OnDestroy {
|
||||
.split(',')
|
||||
.map((ext) => ext.trim().replace(/^\./, ''));
|
||||
|
||||
if (allowedExtensions.indexOf(file.extension) !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return allowedExtensions.indexOf(file.extension) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates FileModel from File
|
||||
*
|
||||
* @param file
|
||||
* @param parentId
|
||||
* @param path
|
||||
* @param id
|
||||
*/
|
||||
protected createFileModel(file: File, parentId: string, path: string, id?: string): FileModel {
|
||||
return new FileModel(file, {
|
||||
|
Reference in New Issue
Block a user