@@ -72,18 +72,20 @@ class OTAPayloadBlobWriter extends zip.Writer {
72
72
// Once the prefixLength is non-zero, the address of manifest and signature
73
73
// become known and can be read in. Otherwise the header needs to be read
74
74
// in first to determine the prefixLength.
75
- if ( this . prefixLength > 0 ) {
76
- if ( this . offset >= this . prefixLength ) {
77
- await this . payload . readManifest ( this . blob )
78
- await this . payload . readSignature ( this . blob )
79
- }
80
- } else if ( this . offset >= _PAYLOAD_HEADER_SIZE ) {
75
+ if ( this . offset >= _PAYLOAD_HEADER_SIZE ) {
81
76
await this . payload . readHeader ( this . blob )
82
77
this . prefixLength =
83
78
_PAYLOAD_HEADER_SIZE
84
79
+ this . payload . manifest_len
85
80
+ this . payload . metadata_signature_len
86
- return
81
+ console . log ( `Computed metadata length: ${ this . prefixLength } ` ) ;
82
+ }
83
+ if ( this . prefixLength > 0 ) {
84
+ console . log ( `${ this . offset } /${ this . prefixLength } ` ) ;
85
+ if ( this . offset >= this . prefixLength ) {
86
+ await this . payload . readManifest ( this . blob )
87
+ await this . payload . readSignature ( this . blob )
88
+ }
87
89
}
88
90
// The prefix has everything we need (header, manifest, signature). Once
89
91
// the offset is beyond the prefix, no need to move on.
@@ -159,12 +161,12 @@ export class Payload {
159
161
this . buffer . slice ( this . cursor , this . cursor + size ) )
160
162
if ( typeof view . getBigUint64 !== "function" ) {
161
163
view . getBigUint64 =
162
- function ( offset ) {
163
- const a = BigInt ( view . getUint32 ( offset ) )
164
- const b = BigInt ( view . getUint32 ( offset + 4 ) )
165
- const bigNumber = a * 4294967296n + b
166
- return bigNumber
167
- }
164
+ function ( offset ) {
165
+ const a = BigInt ( view . getUint32 ( offset ) )
166
+ const b = BigInt ( view . getUint32 ( offset + 4 ) )
167
+ const bigNumber = a * 4294967296n + b
168
+ return bigNumber
169
+ }
168
170
}
169
171
this . cursor += size
170
172
switch ( size ) {
0 commit comments