Fix tar-gz reading of Dockerfiles
- Fixes TAR to actually use data - Fixes buffers for Gunzip to be a proper ArrayBufferView Fixes #1832
This commit is contained in:
parent
640925e47c
commit
5e94f97a42
2 changed files with 4 additions and 5 deletions
|
@ -45,7 +45,7 @@ angular.module('quay').factory('DataFileService', [function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
dataFileService.tryAsTarGz_ = function(buf, success, failure) {
|
dataFileService.tryAsTarGz_ = function(buf, success, failure) {
|
||||||
var gunzip = new Zlib.Gunzip(buf);
|
var gunzip = new Zlib.Gunzip(new Uint8Array(buf));
|
||||||
var plain = null;
|
var plain = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -56,8 +56,7 @@ angular.module('quay').factory('DataFileService', [function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plain.byteLength == 0) {
|
if (plain.byteLength == 0) {
|
||||||
success([]);
|
plain = buf;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dataFileService.tryAsTar_(plain, success, failure);
|
dataFileService.tryAsTar_(plain, success, failure);
|
||||||
|
@ -77,7 +76,7 @@ angular.module('quay').factory('DataFileService', [function() {
|
||||||
return parts.join('/');
|
return parts.join('/');
|
||||||
};
|
};
|
||||||
|
|
||||||
var handler = new Untar(buf);
|
var handler = new Untar(new Uint8Array(buf));
|
||||||
handler.process(function(status, read, files, err) {
|
handler.process(function(status, read, files, err) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'error':
|
case 'error':
|
||||||
|
|
|
@ -371,7 +371,7 @@ if (!Array.prototype.some) {
|
||||||
* @param data The data, in Uint8Array form.
|
* @param data The data, in Uint8Array form.
|
||||||
*/
|
*/
|
||||||
function Untar(data) {
|
function Untar(data) {
|
||||||
this.data = [];
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Untar.prototype.process = function(cb, opt_filter) {
|
Untar.prototype.process = function(cb, opt_filter) {
|
||||||
|
|
Reference in a new issue