From 5e94f97a42ead5a0182b8a0bd41af483b2b4cea3 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 13 Sep 2016 11:34:35 -0400 Subject: [PATCH] Fix tar-gz reading of Dockerfiles - Fixes TAR to actually use data - Fixes buffers for Gunzip to be a proper ArrayBufferView Fixes #1832 --- static/js/services/datafile-service.js | 7 +++---- static/js/tar.js | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/static/js/services/datafile-service.js b/static/js/services/datafile-service.js index 3d80ff26f..cbb458fa5 100644 --- a/static/js/services/datafile-service.js +++ b/static/js/services/datafile-service.js @@ -45,7 +45,7 @@ angular.module('quay').factory('DataFileService', [function() { }; dataFileService.tryAsTarGz_ = function(buf, success, failure) { - var gunzip = new Zlib.Gunzip(buf); + var gunzip = new Zlib.Gunzip(new Uint8Array(buf)); var plain = null; try { @@ -56,8 +56,7 @@ angular.module('quay').factory('DataFileService', [function() { } if (plain.byteLength == 0) { - success([]); - return; + plain = buf; } dataFileService.tryAsTar_(plain, success, failure); @@ -77,7 +76,7 @@ angular.module('quay').factory('DataFileService', [function() { return parts.join('/'); }; - var handler = new Untar(buf); + var handler = new Untar(new Uint8Array(buf)); handler.process(function(status, read, files, err) { switch (status) { case 'error': diff --git a/static/js/tar.js b/static/js/tar.js index f7f079651..960e4144e 100644 --- a/static/js/tar.js +++ b/static/js/tar.js @@ -371,7 +371,7 @@ if (!Array.prototype.some) { * @param data The data, in Uint8Array form. */ function Untar(data) { - this.data = []; + this.data = data; } Untar.prototype.process = function(cb, opt_filter) {