Skip to content

Commit

Permalink
Remove unneeded and buggy stats check (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanZim committed Nov 19, 2022
1 parent b3146f0 commit 1a3205d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/copy/copy-sync.js
Expand Up @@ -146,7 +146,7 @@ function onLink (destStat, src, dest, opts) {
// prevent copy if src is a subdir of dest since unlinking
// dest in this case would result in removing src contents
// and therefore a broken symlink would be created.
if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
}
return copyLink(resolvedSrc, dest)
Expand Down
2 changes: 1 addition & 1 deletion lib/copy/copy.js
Expand Up @@ -219,7 +219,7 @@ function onLink (destStat, src, dest, opts, cb) {
// do not copy if src is a subdir of dest since unlinking
// dest in this case would result in removing src contents
// and therefore a broken symlink would be created.
if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))
}
return copyLink(resolvedSrc, dest, cb)
Expand Down

0 comments on commit 1a3205d

Please sign in to comment.