Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Fix zip loading #1005

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sources/osgPlugins/ReaderWriterZIP.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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);
Expand All @@ -64,6 +64,7 @@ ReaderWriterZIP.prototype = {
break;
}
}
this._filesMap = filesMap;
}.bind(this)
);
}
Expand Down