feat(tvix/store/pathinfosvc): call validate

Change-Id: I557ed67a04112ba3e363303637d1988309250a93
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10535
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
Florian Klink 2024-01-05 13:43:24 +02:00 committed by clbot
parent 6b42aef88d
commit 8e794478bf

View file

@ -38,7 +38,15 @@ impl PathInfoService for GRPCPathInfoService {
.await;
match path_info {
Ok(path_info) => Ok(Some(path_info.into_inner())),
Ok(path_info) => {
let path_info = path_info.into_inner();
path_info
.validate()
.map_err(|e| Error::StorageError(format!("invalid pathinfo: {}", e)))?;
Ok(Some(path_info))
}
Err(e) if e.code() == Code::NotFound => Ok(None),
Err(e) => Err(Error::StorageError(e.to_string())),
}