(source: &Path, target: &Path)
| 514 | } |
| 515 | |
| 516 | pub fn copy_artifact(source: &Path, target: &Path) -> io::Result<u64> { |
| 517 | let meta = source.symlink_metadata()?; |
| 518 | if meta.file_type().is_symlink() { |
| 519 | return Err(invalid_input( |
| 520 | "private store artifact source must not be a symlink", |
| 521 | )); |
| 522 | } |
| 523 | reject_symlink_components(target, "private store artifact target")?; |
| 524 | if meta.is_dir() { |
| 525 | return Self::copy_dir(source, target); |
| 526 | } |
| 527 | if let Some(parent) = target.parent() { |
| 528 | Self::create_dir_all(parent)?; |
| 529 | } |
| 530 | let bytes = fs::copy(source, target)?; |
| 531 | set_private_file_permissions(target)?; |
| 532 | Ok(bytes) |
| 533 | } |
| 534 | |
| 535 | fn copy_dir(source: &Path, target: &Path) -> io::Result<u64> { |
| 536 | Self::create_dir_all(target)?; |
nothing calls this directly
no test coverage detected