Skip to content

Commit

Permalink
Remove unneeded and buggy stats check
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanZim committed Oct 25, 2022
1 parent 0220eac commit fe73a03
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
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,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
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,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 fe73a03

Please sign in to comment.