zen-fs / zip

ZenFS Backend for zip files
https://zen-fs.github.io/zip/
MIT License
5 stars 1 forks source link

Cannot access files in subdirectories #7

Closed atty303 closed 3 months ago

atty303 commented 3 months ago
    const rootZip = await fetch(`https://pob-web-asset.atty303.ninja/versions/v2.42.0/root.zip`);
    await zenfs.configure({
      mounts: {
        "/root": {
          backend: Zip,
          data: await rootZip.arrayBuffer(),
          name: "root.zip",
        },
      },
    });

    console.log(await zenfs.promises.exists("/root/.image.tsv")); // --> This is root file, return true
    console.log(await zenfs.promises.exists("/root/lua/xml.lua")); // --> This is file in directory, return false
    console.log(await zenfs.promises.exists("/root/lua")); // --> This is directory, return false

After a little debugging, it seems that the reason is that there is no entry for the subdirectory itself in ZipFS.entries.

james-pre commented 3 months ago

Yet another problem

This makes sense since the ZIP file does not keep track of files. I will get a comprehensive fix released in a few minutes.

james-pre commented 3 months ago

@atty303 v0.4.5 will hopefully be the last release needed to fix all of these issues.

atty303 commented 3 months ago

Yes, I can confirm that the ZipFS problem has been fixed.