@@ -29,7 +29,7 @@ export const ManifestContent = Type.Object({
2929 ignore : Type . Boolean ( ) ,
3030 zipEntry : Type . String ( )
3131 } ) ,
32- Parameter : Type . Union ( [ Parameter , Type . Array ( Parameter ) ] )
32+ Parameter : Type . Optional ( Type . Union ( [ Parameter , Type . Array ( Parameter ) ] ) )
3333} )
3434
3535export const Group = Type . Object ( {
@@ -219,7 +219,7 @@ export class DataPackage {
219219 * @param [opts.cleanup] If the Zip is parsed as a DataSync successfully, remove the initial zip file
220220 */
221221 static async parse (
222- input : string | URL | Buffer ,
222+ input : string | URL ,
223223 opts ?: {
224224 strict ?: boolean
225225 cleanup ?: boolean
@@ -390,17 +390,19 @@ export class DataPackage {
390390 if ( path . parse ( content . _attributes . zipEntry ) . ext === '.cot' ) continue ;
391391 if ( opts . respectIgnore && content . _attributes . ignore ) continue ;
392392
393- const params = Array . isArray ( content . Parameter ) ? content . Parameter : [ content . Parameter ] ;
394-
395- for ( const param of params ) {
396- if ( param . _attributes . name === 'uid' && cots . has ( param . _attributes . value ) ) {
397- const existing = attachments . get ( param . _attributes . value ) ;
398- if ( existing ) {
399- existing . push ( content ) ;
400- } else {
401- attachments . set ( param . _attributes . value , [ content ] ) ;
393+ if ( content . Parameter ) {
394+ const params = Array . isArray ( content . Parameter ) ? content . Parameter : [ content . Parameter ] ;
395+
396+ for ( const param of params ) {
397+ if ( param . _attributes . name === 'uid' && cots . has ( param . _attributes . value ) ) {
398+ const existing = attachments . get ( param . _attributes . value ) ;
399+ if ( existing ) {
400+ existing . push ( content ) ;
401+ } else {
402+ attachments . set ( param . _attributes . value , [ content ] ) ;
403+ }
404+ break ;
402405 }
403- break ;
404406 }
405407 }
406408 }
0 commit comments