fix(nix-compat/store_path): valid names ⊊ UTF-8
We don't need to validate UTF-8 separately, since valid names are a strict subset of ASCII, and therefore a strict subset of UTF-8. Change-Id: I3261bf0efe3480b5b315074efafcf5e47a6c5a65 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10087 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
9ad7cc629e
commit
2eaee1d48e
1 changed files with 2 additions and 1 deletions
|
|
@ -261,7 +261,8 @@ pub(crate) fn validate_name(s: &(impl AsRef<[u8]> + ?Sized)) -> Result<&str, Err
|
||||||
unreachable!();
|
unreachable!();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(str::from_utf8(s).unwrap())
|
// SAFETY: We permit a subset of ASCII, which guarantees valid UTF-8.
|
||||||
|
Ok(unsafe { str::from_utf8_unchecked(s) })
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for StorePath {
|
impl fmt::Display for StorePath {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue