various code quality fixes (#5792)

* various code quality fixes

* reduce duplicated code

* add safety check
This commit is contained in:
Denys Vuika
2020-06-18 17:57:46 +01:00
committed by GitHub
parent dc2060fe49
commit e9350bd297
54 changed files with 96 additions and 154 deletions

View File

@@ -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, {