Skip to content

[Bug] ZipLoader crashes on folder entries: Cannot read properties of null (reading 'async') #3275

@Jerc92

Description

@Jerc92

Loader

ZipLoader

Description

When parsing a ZIP archive that contains folder entries (directories), the ZipLoader crashes with:

TypeError: Cannot read properties of null (reading 'async')

Root Cause

In loadZipEntry, the code calls jsZip.file(subFilename).async(...) without checking if jsZip.file()
returns null for folder entries:

async function loadZipEntry(jsZip, subFilename, options = {}) {                                      
  try {                                                                                              
    const arrayBuffer = await jsZip.file(subFilename).async(options.dataType || "arraybuffer");      
    return arrayBuffer;                                                                              
  } catch (error) {                                                                                  
    options.log.error(`Unable to read ${subFilename} from zip archive: ${error}`);                   
    return error;                                                                                    
  }                                                                                                  
}

When subFilename is a folder (e.g., AgData/Implements/), jsZip.file(subFilename) returns null.

Expected Behavior

We handle folder entries gracefully.

Steps to Reproduce

  1. Create a zip file with empty folders inside of it.
  2. Load the zip file as an ArrayBuffer
  3. Parse the zip (const result = await parse(buffer, ZipLoader)
  4. Notice the error.

Environment

  • Framework version: 4.3.4
  • Browser: Chrome 142
  • Node: v24.12.0
  • OS: Mac OS

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions