Fix bugs around reading in datafiles and Dockerfiles

We now properly try to read archives in all three formats. If none are valid, the dataFileService.readDataArrayAsPossibleArchive fails (as it should), and then the Dockerfile service will try to read the file directly as a Dockerfile.

Fixes #1889
Fixes #1891
This commit is contained in:
Joseph Schorr 2016-09-29 11:36:57 +02:00
parent 9def2cf055
commit ba0ecf03dd
2 changed files with 7 additions and 2 deletions

View file

@ -133,7 +133,9 @@ angular.module('quay').factory('DataFileService', [function() {
dataFileService.readDataArrayAsPossibleArchive = function(buf, success, failure) {
dataFileService.tryAsZip_(buf, success, function() {
dataFileService.tryAsTarGz_(buf, success, failure);
dataFileService.tryAsTarGz_(buf, success, function() {
dataFileService.tryAsTar_(buf, success, failure);
});
});
};

View file

@ -87,7 +87,10 @@ angular.module('quay').factory('DockerfileService', ['DataFileService', 'Config'
var dataArray = reader.result;
DataFileService.readDataArrayAsPossibleArchive(dataArray, function(files) {
processFiles(files, dataArray, success, failure);
}, failure);
}, function() {
// Not an archive. Read directly as a single file.
processFiles([], dataArray, success, failure);
});
};
reader.onerror = failure;