Skip to content

fix(sdk): preserve filenames in fs.readdir - #383

Open
mmarufov wants to merge 1 commit into
vercel:mainfrom
mmarufov:mmarufov/vercel-sandbox-directory-listing
Open

mmarufov wants to merge 1 commit into
vercel:mainfrom
mmarufov:mmarufov/vercel-sandbox-directory-listing

Conversation

@mmarufov

@mmarufov mmarufov commented Oct 13, 2026 •

Copy link
Copy Markdown

Closes #379.

fs.readdir() splits valid filenames on newlines and |, truncating names or producing extra entries such as ...

Use NUL-delimited find -printf output in both modes, with the type before the name for withFileTypes. Preserve filename whitespace, treat relative paths literally, and update the mock's formatter.

Compatibility

  • Listings now include dotfiles and use consistent name ordering. Directory symlinks are followed in both modes; child symlinks retain their type.
  • Upgrade @vercel/sandbox-mock together with @vercel/sandbox; older mocks cannot handle the new command. A patch changeset covers both packages.
  • A regular-file input now returns [] in plain mode instead of [path]. Node-compatible ENOTDIR handling remains outside this change.

Validation

  • Build and typecheck passed for the SDK, mock, and CLI; all 878 existing and new local tests passed.
  • Regression checks fail with the original implementation and pass with the fix. Local GNU find checks also covered symlinks, empty/missing paths, and option-like paths.
  • The targeted live compatibility test passed on c9a985a, verifying exact names and file types in both modes, directly and through a directory symlink. NUL output survived the real API, and the sandbox was confirmed stopped. The full integration suite was not run.

@vercel

vercel Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@mmarufov is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

readdir output parsing is ambiguous for filenames containing a newline or a pipe

1 participant