about summary refs log tree commit diff
path: root/tvix/castore/src/proto/mod.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-08-17T19·00+0300
committerclbot <clbot@tvl.fyi>2024-08-18T17·22+0000
commite086c76ee941198c70756e1b7b383edcb3572b4b (patch)
tree58fbfe1eeb992489a2feff0bf9ff8852309cd720 /tvix/castore/src/proto/mod.rs
parent56fa533e438bd367aa5cae6fa505508aced42156 (diff)
refactor(tvix/castore): have SymlinkTarget-specific errors r/8514
Don't use ValidateNodeError, but SymlinkTargetError.

Also, add checks for too long symlink targets.

Change-Id: I4b533325d494232ff9d0b3f4f695f5a1a0a36199
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12230
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/castore/src/proto/mod.rs')
-rw-r--r--tvix/castore/src/proto/mod.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/tvix/castore/src/proto/mod.rs b/tvix/castore/src/proto/mod.rs
index 67f7b2fa72a2..8bc74b412676 100644
--- a/tvix/castore/src/proto/mod.rs
+++ b/tvix/castore/src/proto/mod.rs
@@ -223,10 +223,12 @@ impl Node {
                 let name: PathComponent = n.name.try_into().map_err(DirectoryError::InvalidName)?;
 
                 let node = crate::Node::Symlink {
-                    target: n
-                        .target
-                        .try_into()
-                        .map_err(|e| DirectoryError::InvalidNode(name.clone(), e))?,
+                    target: n.target.try_into().map_err(|e| {
+                        DirectoryError::InvalidNode(
+                            name.clone(),
+                            crate::ValidateNodeError::InvalidSymlinkTarget(e),
+                        )
+                    })?,
                 };
 
                 Ok((name, node))