Skip to content

Commit bccd595

Browse files
authored
fix(cli): trim leading slash in download_prefix to prevent Path::join treating relative path as absolute (#247)
1 parent ca78818 commit bccd595

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • crates/cli/src/commands

crates/cli/src/commands/cp.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,11 @@ async fn download_prefix(
631631
}
632632

633633
// Calculate relative path from prefix
634-
let relative_key = item.key.strip_prefix(&src.key).unwrap_or(&item.key);
634+
let relative_key = item
635+
.key
636+
.strip_prefix(&src.key)
637+
.unwrap_or(&item.key)
638+
.trim_start_matches('/');
635639
let dst_path =
636640
dst.join(relative_key.replace('/', std::path::MAIN_SEPARATOR_STR));
637641

0 commit comments

Comments
 (0)