Commit c5bd6a8c authored by Ronny's avatar Ronny

修改zipjs L719 catch

parent 61db630e
...@@ -716,11 +716,17 @@ ...@@ -716,11 +716,17 @@
function seekEOCDR(offset, entriesCallback) { function seekEOCDR(offset, entriesCallback) {
reader.readUint8Array(reader.size - offset, offset, function(bytes) { reader.readUint8Array(reader.size - offset, offset, function(bytes) {
var dataView = getDataHelper(bytes.length, bytes).view; var dataView = getDataHelper(bytes.length, bytes).view;
if (dataView.getUint32(0) != 0x504b0506) { try{
seekEOCDR(offset + 1, entriesCallback); if (dataView.getUint32(0) != 0x504b0506) {
} else { seekEOCDR(offset + 1, entriesCallback);
entriesCallback(dataView); } else {
entriesCallback(dataView);
}
}catch(e){
console.log(e);
onerror(ERR_READ);
} }
}, function() { }, function() {
onerror(ERR_READ); onerror(ERR_READ);
}); });
......
...@@ -74,6 +74,10 @@ KityMinder.registerProtocal( 'mindmanager', function () { ...@@ -74,6 +74,10 @@ KityMinder.registerProtocal( 'mindmanager', function () {
return result; return result;
} }
function onerror(){
alert('xmind文件过程解压出错,请检查该文件是否损坏');
}
function getEntries( file, onend ) { function getEntries( file, onend ) {
zip.createReader( new zip.BlobReader( file ), function ( zipReader ) { zip.createReader( new zip.BlobReader( file ), function ( zipReader ) {
zipReader.getEntries( onend ); zipReader.getEntries( onend );
......
...@@ -80,6 +80,10 @@ KityMinder.registerProtocal( 'xmind', function () { ...@@ -80,6 +80,10 @@ KityMinder.registerProtocal( 'xmind', function () {
return result; return result;
} }
function onerror(){
alert('xmind文件过程解压出错,请检查该文件是否损坏');
}
function getEntries(file, onend) { function getEntries(file, onend) {
zip.createReader(new zip.BlobReader(file), function(zipReader) { zip.createReader(new zip.BlobReader(file), function(zipReader) {
zipReader.getEntries(onend); zipReader.getEntries(onend);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment