@@ -30,7 +30,7 @@ use socket_patch_core::api::client::{get_api_client_with_overrides, ApiClient}; |
30 | 30 | use socket_patch_core::constants::SOCKET_DIR; |
31 | 31 | use socket_patch_core::manifest::schema::{PatchManifest, PatchRecord}; |
32 | 32 | use socket_patch_core::patch::copy_tree::remove_tree; |
33 | | -use socket_patch_core::utils::fs::read_regular_to_string; |
| 33 | +use socket_patch_core::utils::fs::{read_regular_to_bytes, read_regular_to_string}; |
34 | 34 | use socket_patch_core::utils::purl::normalize_purl; |
35 | 35 | use socket_patch_core::vendor::{ |
36 | 36 | self, artifact_is_file_shaped, check_vendored_artifact, load_state, parse_vendor_path, |
@@ -1058,14 +1058,10 @@ async fn snapshot_wiring(cwd: &Path, candidates: &[Candidate]) -> Vec<(PathBuf, |
1058 | 1058 | let mut out = Vec::with_capacity(rels.len()); |
1059 | 1059 | for rel in rels { |
1060 | 1060 | let path = cwd.join(&rel); |
1061 | | - match tokio::fs::symlink_metadata(&path).await { |
1062 | | - Ok(meta) if meta.is_file() => { |
1063 | | - if let Ok(bytes) = tokio::fs::read(&path).await { |
1064 | | - out.push((path, Some(bytes))); |
1065 | | - } |
1066 | | - } |
1067 | | - Ok(_) => {} |
1068 | | - Err(_) => out.push((path, None)), |
| 1061 | + match read_regular_to_bytes(&path).await { |
| 1062 | + Ok(bytes) => out.push((path, Some(bytes))), |
| 1063 | + Err(e) if e.kind() == std::io::ErrorKind::NotFound => out.push((path, None)), |
| 1064 | + Err(_) => {} |
1069 | 1065 | } |
1070 | 1066 | } |
1071 | 1067 | out |
@@ -1088,7 +1084,7 @@ fn keeps_identity(health: &ArtifactHealth) -> bool { |
1088 | 1084 | async fn undo_candidate(cwd: &Path, c: &Candidate, snapshot: &[(PathBuf, Option<Vec<u8>>)]) { |
1089 | 1085 | let wired: HashSet<PathBuf> = c.entry.wiring.iter().map(|w| cwd.join(&w.file)).collect(); |
1090 | 1086 | for (path, bytes) in snapshot.iter().filter(|(p, _)| wired.contains(p)) { |
1091 | | - if tokio::fs::read(path).await.ok().as_ref() == bytes.as_ref() { |
| 1087 | + if read_regular_to_bytes(path).await.ok().as_ref() == bytes.as_ref() { |
1092 | 1088 | continue; |
1093 | 1089 | } |
1094 | 1090 | match bytes { |
|