Skip to content

Commit 9302542

Browse files
committed
Fix canonicalization
1 parent 2270657 commit 9302542

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> Result<u64> {
2525
// limit doesn't apply. Fallback to the original path if canonicalization fails. This can happen
2626
// on Windows when using a network drive.
2727
let from = from.as_ref().canonicalize().unwrap_or_else(|_| from.as_ref().to_owned());
28-
let to = to.as_ref().canonicalize().unwrap_or_else(|_| to.as_ref().to_owned());
28+
let to = to.as_ref().parent().unwrap().canonicalize().map(|path| path.join(to.as_ref().file_name().unwrap())).unwrap_or_else(|_| to.as_ref().to_owned());
2929

3030
if fs::symlink_metadata(&from)?.file_type().is_symlink() {
3131
let link = fs::read_link(&from)?;

0 commit comments

Comments
 (0)