summaryrefslogtreecommitdiff
path: root/ext/node
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-10-17 12:51:15 -0700
committerGitHub <noreply@github.com>2024-10-17 19:51:15 +0000
commit9fde5cb5e045551fe344b3f60370744eea30ccb4 (patch)
treef407e3358a710927c2e6967fd9023ddd26581bfe /ext/node
parenteca83fc9b45ab1e5a73bd7b13b05ee42ab1a4dcc (diff)
fix(node/fs): copyFile with `COPYFILE_EXCL` should not throw if the destination doesn't exist (#26360)
Fixes #26313. We were checking for the NotFound error, but still calling the callback with the error / throwing.
Diffstat (limited to 'ext/node')
-rw-r--r--ext/node/polyfills/_fs/_fs_copy.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/node/polyfills/_fs/_fs_copy.ts b/ext/node/polyfills/_fs/_fs_copy.ts
index 2f8ddf4fc..0434bff4d 100644
--- a/ext/node/polyfills/_fs/_fs_copy.ts
+++ b/ext/node/polyfills/_fs/_fs_copy.ts
@@ -53,8 +53,9 @@ export function copyFile(
}, (e) => {
if (e instanceof Deno.errors.NotFound) {
Deno.copyFile(srcStr, destStr).then(() => cb(null), cb);
+ } else {
+ cb(e);
}
- cb(e);
});
} else {
Deno.copyFile(srcStr, destStr).then(() => cb(null), cb);
@@ -83,8 +84,9 @@ export function copyFileSync(
} catch (e) {
if (e instanceof Deno.errors.NotFound) {
Deno.copyFileSync(srcStr, destStr);
+ } else {
+ throw e;
}
- throw e;
}
} else {
Deno.copyFileSync(srcStr, destStr);