(source: &Path, target: &Path)
| 533 | } |
| 534 | |
| 535 | fn copy_dir(source: &Path, target: &Path) -> io::Result<u64> { |
| 536 | Self::create_dir_all(target)?; |
| 537 | let mut bytes = 0; |
| 538 | let mut entries = fs::read_dir(source)?.collect::<io::Result<Vec<_>>>()?; |
| 539 | entries.sort_by_key(std::fs::DirEntry::path); |
| 540 | for entry in entries { |
| 541 | let source_path = entry.path(); |
| 542 | let target_path = target.join(entry.file_name()); |
| 543 | let meta = source_path.symlink_metadata()?; |
| 544 | if meta.file_type().is_symlink() { |
| 545 | return Err(invalid_input( |
| 546 | "private store artifact source must not contain symlinks", |
| 547 | )); |
| 548 | } |
| 549 | if meta.is_dir() { |
| 550 | bytes += Self::copy_dir(&source_path, &target_path)?; |
| 551 | } else if meta.is_file() { |
| 552 | bytes += Self::copy_artifact(&source_path, &target_path)?; |
| 553 | } |
| 554 | } |
| 555 | Ok(bytes) |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | fn reject_symlink_components(path: &Path, subject: &str) -> io::Result<()> { |
nothing calls this directly
no test coverage detected