diff --git a/sources/osgPlugins/ReaderWriterZIP.js b/sources/osgPlugins/ReaderWriterZIP.js index eb9405b94..30313f071 100644 --- a/sources/osgPlugins/ReaderWriterZIP.js +++ b/sources/osgPlugins/ReaderWriterZIP.js @@ -22,9 +22,9 @@ ReaderWriterZIP.prototype = { var self = this; if (options && options.filesMap !== undefined) { // it comes from drag'n drop - if (options.filesMap[url] !== undefined) { + if (options.filesMap.has(url) !== undefined) { // Now url is a File - var file = options.filesMap[url]; + var file = options.filesMap.get(url); return this.readZipFile(file).then(function() { if (!self._fileName) return P.reject(self); // At this point we have the main file name and a Map containing all the resources @@ -40,7 +40,7 @@ ReaderWriterZIP.prototype = { }); return filePromise.then(function(zfile) { - self.readZipFile(zfile).then(function() { + return self.readZipFile(zfile).then(function() { // At this point we have the main file name and a Map containing all the resources return ReaderParser.readNodeURL(self._fileName, { filesMap: self._filesMap @@ -50,7 +50,7 @@ ReaderWriterZIP.prototype = { }, readZipFile: function(fileOrBlob) { - fileHelper.unzip(fileOrBlob).then( + return fileHelper.unzip(fileOrBlob).then( function(filesMap) { for (var fileName in filesMap) { var extension = fileHelper.getExtension(fileName); @@ -64,6 +64,7 @@ ReaderWriterZIP.prototype = { break; } } + this._filesMap = filesMap; }.bind(this) ); }