refactor(nix-compat/store_path): use nixbase32::decode_fixed
Change-Id: I81471ee57920aa8fa889fb00c7903cdc570af9c5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9863 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
50aa74a59c
commit
b1ad94cc9a
1 changed files with 2 additions and 4 deletions
|
@ -203,10 +203,8 @@ impl<'a> StorePathRef<'a> {
|
|||
Err(Error::InvalidLength)?
|
||||
}
|
||||
|
||||
let digest = match nixbase32::decode(&s[..ENCODED_DIGEST_SIZE]) {
|
||||
Ok(decoded) => decoded,
|
||||
Err(decoder_error) => return Err(Error::InvalidHashEncoding(decoder_error)),
|
||||
};
|
||||
let digest = nixbase32::decode_fixed(&s[..ENCODED_DIGEST_SIZE])
|
||||
.map_err(Error::InvalidHashEncoding)?;
|
||||
|
||||
if s[ENCODED_DIGEST_SIZE] != b'-' {
|
||||
return Err(Error::MissingDash);
|
||||
|
|
Loading…
Reference in a new issue