Browse Source

Merge pull request #7211 from ArtemDzhereleiko/AD/bug-fix/file-input

[3.4.2] UI: Fixed file input loader
pull/7236/head
Igor Kulikov 4 years ago
committed by GitHub
parent
commit
66bdf4b7eb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      ui-ngx/src/app/shared/components/file-input.component.ts

18
ui-ngx/src/app/shared/components/file-input.component.ts

@ -188,20 +188,18 @@ export class FileInputComponent extends PageComponent implements AfterViewInit,
let fileName = null; let fileName = null;
let fileContent = null; let fileContent = null;
let files = null; let files = null;
if (typeof reader.result === 'string') { if (reader.readyState === reader.DONE) {
fileContent = reader.result; if (!this.workFromFileObj) {
if (fileContent && fileContent.length > 0) { fileContent = reader.result;
if (!this.workFromFileObj) { if (fileContent && fileContent.length > 0) {
if (this.contentConvertFunction) { if (this.contentConvertFunction) {
fileContent = this.contentConvertFunction(fileContent); fileContent = this.contentConvertFunction(fileContent);
} }
if (fileContent) { fileName = fileContent ? file.name : null;
fileName = file.name;
}
} else {
files = file.file;
fileName = file.name;
} }
} else if (file.name || file.file){
files = file.file;
fileName = file.name;
} }
} }
resolve({fileContent, fileName, files}); resolve({fileContent, fileName, files});

Loading…
Cancel
Save