LIB: fix bug in throwDestinationInSource
We should only run canoncializePath on dirname, otherwise realPath will likely fail.
This commit is contained in:
parent
d8fc529bf1
commit
8c95aa312a
@ -111,11 +111,11 @@ throwSameFile fp1 fp2 = do
|
|||||||
|
|
||||||
|
|
||||||
throwDestinationInSource :: Path Abs -- ^ will be canonicalized
|
throwDestinationInSource :: Path Abs -- ^ will be canonicalized
|
||||||
-> Path Abs -- ^ will be canonicalized
|
-> Path Abs -- ^ `dirname dest` will be canonicalized
|
||||||
-> IO ()
|
-> IO ()
|
||||||
throwDestinationInSource source dest = do
|
throwDestinationInSource source dest = do
|
||||||
source' <- P.canonicalizePath source
|
source' <- P.canonicalizePath source
|
||||||
cDestbase <- fmap P.dirname $ P.canonicalizePath dest
|
cDestbase <- P.canonicalizePath $ P.dirname dest
|
||||||
let dest' = cDestbase P.</> P.basename dest
|
let dest' = cDestbase P.</> P.basename dest
|
||||||
when (source' `P.isParentOf` dest')
|
when (source' `P.isParentOf` dest')
|
||||||
(throw $ DestinationInSource (P.fromAbs dest') (P.fromAbs source'))
|
(throw $ DestinationInSource (P.fromAbs dest') (P.fromAbs source'))
|
||||||
|
Loading…
Reference in New Issue
Block a user