diff --git a/static/js/services/dockerfile/dockerfile.service.impl.ts b/static/js/services/dockerfile/dockerfile.service.impl.ts index 5cb861749..e2826b54c 100644 --- a/static/js/services/dockerfile/dockerfile.service.impl.ts +++ b/static/js/services/dockerfile/dockerfile.service.impl.ts @@ -15,14 +15,19 @@ export class DockerfileServiceImpl implements DockerfileService { return new Promise((resolve, reject) => { var reader: FileReader = this.fileReaderFactory(); reader.onload = (event: any) => { - // FIXME: Debugging - console.log(event.target.result); - this.DataFileService.readDataArrayAsPossibleArchive(event.target.result, (files: any[]) => { - this.processFiles(files) - .then((dockerfileInfo: DockerfileInfoImpl) => resolve(dockerfileInfo)) - .catch((error: string) => reject(error)); + if (files.length > 0) { + this.processFiles(files) + .then((dockerfileInfo: DockerfileInfoImpl) => resolve(dockerfileInfo)) + .catch((error: string) => reject(error)); + } + // Not an archive. Read directly as a single file. + else { + this.processFile(event.target.result) + .then((dockerfileInfo: DockerfileInfoImpl) => resolve(dockerfileInfo)) + .catch((error: string) => reject(error)); + } }, () => { // Not an archive. Read directly as a single file.