diff options
Diffstat (limited to 'tvix/store/src/proto/mod.rs')
-rw-r--r-- | tvix/store/src/proto/mod.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/tvix/store/src/proto/mod.rs b/tvix/store/src/proto/mod.rs index a982d71f8886..4b5bf4f59479 100644 --- a/tvix/store/src/proto/mod.rs +++ b/tvix/store/src/proto/mod.rs @@ -140,6 +140,19 @@ impl PathInfo { ); } } + + // If the Deriver field is populated, ensure it parses to a + // [store_path::StorePath]. + // We can't check for it to *not* end with .drv, as the .drv files produced by + // recursive Nix end with multiple .drv suffixes, and only one is popped when + // converting to this field. + if let Some(deriver) = &narinfo.deriver { + store_path::StorePath::from_name_and_digest( + deriver.name.clone(), + &deriver.digest, + ) + .map_err(ValidatePathInfoError::InvalidDeriverField)?; + } } } @@ -156,16 +169,6 @@ impl PathInfo { } }; - // If the Deriver field is populated, ensure it parses to a - // [store_path::StorePath]. - // We can't check for it to *not* end with .drv, as the .drv files produced by - // recursive Nix end with multiple .drv suffixes, and only one is popped when - // converting to this field. - if let Some(deriver) = &self.deriver { - store_path::StorePath::from_name_and_digest(deriver.name.clone(), &deriver.digest) - .map_err(ValidatePathInfoError::InvalidDeriverField)?; - } - // return the root nix path Ok(root_nix_path) } |