Merge pull request #46 from noodoo/fix/lower-case-files

Fix file getter: letter case not match
This commit is contained in:
protobi 2016-09-28 21:35:57 -04:00 committed by GitHub
commit d5092b42cb
2 changed files with 16 additions and 4 deletions

@ -15,8 +15,14 @@ function getdata(data) {
function safegetzipfile(zip, file) {
var f = file; if(zip.files[f]) return zip.files[f];
f = file.toLowerCase(); if(zip.files[f]) return zip.files[f];
f = f.replace(/\//g,'\\'); if(zip.files[f]) return zip.files[f];
var lowerCaseFiles = {};
for (var key in zip.files) {
lowerCaseFiles[key.toLowerCase()] = zip.files[key];
}
f = file.toLowerCase(); if(lowerCaseFiles[f]) return lowerCaseFiles[f];
f = f.replace(/\//g,'\\'); if(lowerCaseFiles[f]) return lowerCaseFiles[f];
return null;
}

10
xlsx.js

@ -1314,8 +1314,14 @@ function getdata(data) {
function safegetzipfile(zip, file) {
var f = file; if(zip.files[f]) return zip.files[f];
f = file.toLowerCase(); if(zip.files[f]) return zip.files[f];
f = f.replace(/\//g,'\\'); if(zip.files[f]) return zip.files[f];
var lowerCaseFiles = {};
for (var key in zip.files) {
lowerCaseFiles[key.toLowerCase()] = zip.files[key];
}
f = file.toLowerCase(); if(lowerCaseFiles[f]) return lowerCaseFiles[f];
f = f.replace(/\//g,'\\'); if(lowerCaseFiles[f]) return lowerCaseFiles[f];
return null;
}