Skip to content

Commit

Permalink
Fix isSrcSubdir() split bug
Browse files Browse the repository at this point in the history
  • Loading branch information
manidlou committed Jul 10, 2017
1 parent f8f441a commit d99d8a1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/move/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,11 @@ function isSrcSubdir (src, dest, cb) {
if (err) return cb(err)
if (st.isDirectory()) {
const baseDir = dest.split(path.dirname(src) + path.sep)[1]
const destBasename = baseDir.split(path.sep)[0]
if (baseDir && destBasename) return cb(null, src !== dest && dest.indexOf(src) > -1 && destBasename === path.basename(src))
if (baseDir) {
const destBasename = baseDir.split(path.sep)[0]
if (destBasename) return cb(null, src !== dest && dest.indexOf(src) > -1 && destBasename === path.basename(src))
return cb(null, false)
}
return cb(null, false)
}
return cb(null, false)
Expand Down

0 comments on commit d99d8a1

Please sign in to comment.