From df4848921185fb1b7f707f6f1575865a939f36ee Mon Sep 17 00:00:00 2001 From: SheetJS Date: Sun, 6 Nov 2022 21:58:41 -0500 Subject: [PATCH] Numbers 12.2 skip ActivityStream.iwa --- bits/83_numbers.js | 6 +++--- modules/83_numbers.js | 6 +++--- modules/83_numbers.ts | 11 ++++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bits/83_numbers.js b/bits/83_numbers.js index 037ac62..63a51b6 100644 --- a/bits/83_numbers.js +++ b/bits/83_numbers.js @@ -1039,7 +1039,7 @@ function parse_numbers_iwa(cfb, opts) { cfb.FileIndex.forEach(function(s) { if (!s.name.match(/\.iwa$/)) return; - if (s.content[0] == 98) + if (s.content[0] != 0) return; var o; try { @@ -1191,7 +1191,7 @@ function build_numbers_deps(cfb) { return; if (!fi.name.match(/\.iwa/)) return; - if (fi.name.match(/OperationStorage/)) + if (fi.content[0] != 0) return; parse_iwa_file(decompress_iwa_file(fi.content)).forEach(function(packet) { indices.push(packet.id); @@ -1201,7 +1201,7 @@ function build_numbers_deps(cfb) { cfb.FileIndex.forEach(function(fi) { if (!fi.name.match(/\.iwa/)) return; - if (fi.name.match(/OperationStorage/)) + if (fi.content[0] != 0) return; parse_iwa_file(decompress_iwa_file(fi.content)).forEach(function(ia) { ia.messages.forEach(function(mess) { diff --git a/modules/83_numbers.js b/modules/83_numbers.js index 037ac62..63a51b6 100644 --- a/modules/83_numbers.js +++ b/modules/83_numbers.js @@ -1039,7 +1039,7 @@ function parse_numbers_iwa(cfb, opts) { cfb.FileIndex.forEach(function(s) { if (!s.name.match(/\.iwa$/)) return; - if (s.content[0] == 98) + if (s.content[0] != 0) return; var o; try { @@ -1191,7 +1191,7 @@ function build_numbers_deps(cfb) { return; if (!fi.name.match(/\.iwa/)) return; - if (fi.name.match(/OperationStorage/)) + if (fi.content[0] != 0) return; parse_iwa_file(decompress_iwa_file(fi.content)).forEach(function(packet) { indices.push(packet.id); @@ -1201,7 +1201,7 @@ function build_numbers_deps(cfb) { cfb.FileIndex.forEach(function(fi) { if (!fi.name.match(/\.iwa/)) return; - if (fi.name.match(/OperationStorage/)) + if (fi.content[0] != 0) return; parse_iwa_file(decompress_iwa_file(fi.content)).forEach(function(ia) { ia.messages.forEach(function(mess) { diff --git a/modules/83_numbers.ts b/modules/83_numbers.ts index 8a55742..68b250c 100644 --- a/modules/83_numbers.ts +++ b/modules/83_numbers.ts @@ -165,7 +165,7 @@ interface ProtoItem { data: Uint8Array; type: number; } -type ProtoField = Array +type ProtoField = Array; type ProtoMessage = Array; /** Shallow parse of a Protobuf message */ function parse_shallow(buf: Uint8Array): ProtoMessage { @@ -397,6 +397,7 @@ var numbers_lut_new = (): DataLUT => ({ sst: [], rsst: [], ofmt: [], nfmt: [] }) function numbers_format_cell(cell: CellObject, t: number, flags: number, ofmt: ProtoMessage, nfmt: ProtoMessage): void { var ctype = t & 0xFF, ver = t >> 8; + /* .TSK.FormatStructArchive */ var fmt = ver >= 5 ? nfmt : ofmt; dur: if((flags & (ver > 4 ? 8: 4)) && cell.t == "n" && ctype == 7) { var dstyle = (fmt[7]?.[0]) ? varint_to_i32(fmt[7][0].data) : -1; @@ -871,7 +872,7 @@ function parse_numbers_iwa(cfb: CFB$Container, opts?: ParsingOptions ): WorkBook /* collect entire message space */ cfb.FileIndex.forEach(s => { if(!s.name.match(/\.iwa$/)) return; - if(s.content[0] == 98) return; // TODO: OperationStorage.iwa + if(s.content[0] != 0) return; // TODO: this should test if the iwa follows the framing format var o: Uint8Array; try { o = decompress_iwa_file(s.content as Uint8Array); } catch(e) { return console.log("?? " + s.content.length + " " + (e.message || e)); } var packets: IWAArchiveInfo[]; @@ -1010,7 +1011,7 @@ function build_numbers_deps(cfb: CFB$Container): Dependents { var fi = row[0], fp = row[1]; if(fi.type != 2) return; if(!fi.name.match(/\.iwa/)) return; - if(fi.name.match(/OperationStorage/)) return; + if((fi.content as Uint8Array)[0] != 0) return; // TODO: this should test if the iwa follows the framing format parse_iwa_file(decompress_iwa_file(fi.content as Uint8Array)).forEach(packet => { indices.push(packet.id); @@ -1021,14 +1022,14 @@ function build_numbers_deps(cfb: CFB$Container): Dependents { /* build dependent tree */ cfb.FileIndex.forEach(fi => { if(!fi.name.match(/\.iwa/)) return; - if(fi.name.match(/OperationStorage/)) return; + if((fi.content as Uint8Array)[0] != 0) return; // TODO: this should test if the iwa follows the framing format parse_iwa_file(decompress_iwa_file(fi.content as Uint8Array)).forEach(ia => { ia.messages.forEach(mess => { [5,6].forEach(f => { if(!mess.meta[f]) return; mess.meta[f].forEach(x => { dependents[ia.id].deps.push(varint_to_i32(x.data)); - }) + }); }); }); });