nodejs / nodejs/node

vfs: ZipProvider allows creating entries beneath non-directory parents

Open
#65,828 0 comments 1 reaction 1 assignee View on GitHub

@trivikr is already working on this.

Since Sep 5, 2026.

vfs
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

main

Platform
macOS
Subsystem

vfs

What steps will reproduce the bug?
import { createZipArchive, ZipBuffer, ZipEntry } from 'node:zlib';
import { create, ZipProvider } from 'node:vfs';

const zipEntry = await ZipEntry.create('file.txt', Buffer.from('contents'));
const zipArchive = createZipArchive([zipEntry]);
const archive = Buffer.concat(await Array.fromAsync(zipArchive));
const fs = create(new ZipProvider(new ZipBuffer(archive)));

try {
  await fs.promises.writeFile('/file.txt/child.txt', 'hello');
  console.log('write succeeded');
} catch (error) {
  console.log(`${error.code}: ${error.message}`);
}
How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

It should fail with ENOTDIR

What do you see instead?
write succeeded

The write incorrectly succeeds even though file.txt is not a directory

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.