Skip to content

Commit

Permalink
Fix BnStrCompatible impl for &Path
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrasnitski authored and emesare committed Jan 28, 2025
1 parent b3f2ef8 commit 7fc1623
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rust/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ unsafe impl BnStrCompatible for &Path {
type Result = Vec<u8>;

fn into_bytes_with_nul(self) -> Self::Result {
self.as_os_str().as_encoded_bytes().to_vec()
let ret = CString::new(self.as_os_str().as_encoded_bytes())
.expect("can't pass paths with internal nul bytes to core!");
ret.into_bytes_with_nul()
}
}

Expand Down

0 comments on commit 7fc1623

Please sign in to comment.