|
1 | 1 | function firstbyte(f/*:RawData*/,o/*:?TypeOpts*/)/*:Array<number>*/ {
|
2 | 2 | var x = "";
|
3 | 3 | switch((o||{}).type || "base64") {
|
4 |
| - case 'buffer': return [f[0], f[1], f[2], f[3]]; |
5 |
| - case 'base64': x = Base64.decode(f.slice(0,24)); break; |
| 4 | + case 'buffer': return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]]; |
| 5 | + case 'base64': x = Base64.decode(f.slice(0,12)); break; |
6 | 6 | case 'binary': x = f; break;
|
7 |
| - case 'array': return [f[0], f[1], f[2], f[3]]; |
| 7 | + case 'array': return [f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7]]; |
8 | 8 | default: throw new Error("Unrecognized type " + (o && o.type || "undefined"));
|
9 | 9 | }
|
10 |
| - return [x.charCodeAt(0), x.charCodeAt(1), x.charCodeAt(2), x.charCodeAt(3)]; |
| 10 | + return [x.charCodeAt(0), x.charCodeAt(1), x.charCodeAt(2), x.charCodeAt(3), x.charCodeAt(4), x.charCodeAt(5), x.charCodeAt(6), x.charCodeAt(7)]; |
11 | 11 | }
|
12 | 12 |
|
13 | 13 | function read_cfb(cfb/*:CFBContainer*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
@@ -82,7 +82,7 @@ function readSync(data/*:RawData*/, opts/*:?ParseOpts*/)/*:Workbook*/ {
|
82 | 82 | if(!vu.foo) {o=dup(o); o.type='array'; return readSync(ab2a(d), o);}
|
83 | 83 | }
|
84 | 84 | switch((n = firstbyte(d, o))[0]) {
|
85 |
| - case 0xD0: return read_cfb(CFB.read(d, o), o); |
| 85 | + case 0xD0: if(n[1] === 0xCF && n[2] === 0x11 && n[3] === 0xE0 && n[4] === 0xA1 && n[5] === 0xB1 && n[6] === 0x1A && n[7] === 0xE1) return read_cfb(CFB.read(d, o), o); break; |
86 | 86 | case 0x09: if(n[1] <= 0x04) return parse_xlscfb(d, o); break;
|
87 | 87 | case 0x3C: return parse_xlml(d, o);
|
88 | 88 | case 0x49: if(n[1] === 0x44) return read_wb_ID(d, o); break;
|
|
0 commit comments