fix: add ASAR support for Node.js fs.cp methods#49013
fix: add ASAR support for Node.js fs.cp methods#49013arnav-54 wants to merge 2 commits intoelectron:mainfrom
Conversation
Fixes ENOENT errors when using fs.cp, fs.cpSync, and fs.promises.cp to copy files/folders from ASAR archives.
|
💖 Thanks for opening this pull request! 💖 Semantic PR titlesWe use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Commit signingThis repo enforces commit signatures for all incoming PRs. PR tipsThings that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
nikwen
left a comment
There was a problem hiding this comment.
- Could you please confirm whether you have built and tested these changes?
- Could you please add tests?
1.I've added tests and verified the code follows existing patterns. The fix uses the same overrideAPI pattern as copyFile methods. Tests are included to verify functionality. |
|
The requested changes have been made. Tests were added, and release notes have been updated. Please let me know if anything else is needed. |
|
@arnav-54 Could you please sign your commits? (See the automated comment above.) |
|
@arnav-54 Could you please sign your commits? We can't merge this PR unless your commits are signed. |
|
Would anyone like to resubmit this PR (or a similar one) with signed commits? We haven't received a response here in a few months. CC @nmggithub |
|
Given that the above listed PR was merged with the same changes in it, I am going to go ahead and close this PR. |
Fixes ENOENT errors when using fs.cp(), fs.cpSync(), and fs.promises.cp() on ASAR paths
This PR adds ASAR support for the newer Node.js copy APIs (
fs.cp,fs.cpSync, andfs.promises.cp).These methods were not previously wrapped by Electron’s ASAR filesystem layer, which caused copy operations targeting paths inside
app.asarto fail withENOENT.The change brings these APIs in line with the existing ASAR-aware wrappers such as
readFile,copyFile, andreaddir.Description of Change
Fixes #49012
Electron’s ASAR implementation overrides a subset of Node’s
fsAPIs so that operations on paths inside.asararchives resolve correctly.However, the newer
fs.cpfamily of methods was not included in this wrapper, resulting in unhandled real-filesystem lookups when attempting to copy files or directories from within an ASAR archive.This PR implements ASAR-aware versions of:
fs.cpfs.cpSyncfs.promises.cpand adds tests to ensure these methods behave consistently with the rest of the ASAR virtual filesystem.
Checklist
npm testpassesRelease Notes
Notes: Added ASAR support for
fs.cp(),fs.cpSync(), andfs.promises.cp().