refactor(tvix/castore): have SymlinkTarget-specific errors
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
This commit is contained in:
parent
56fa533e43
commit
e086c76ee9
5 changed files with 172 additions and 26 deletions
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use crate::directoryservice::{DirectoryPutter, DirectoryService};
|
||||
use crate::path::{Path, PathBuf};
|
||||
use crate::{B3Digest, Directory, Node};
|
||||
use crate::{B3Digest, Directory, Node, SymlinkTargetError};
|
||||
use futures::{Stream, StreamExt};
|
||||
use tracing::Level;
|
||||
|
||||
|
|
@ -91,10 +91,10 @@ where
|
|||
}
|
||||
IngestionEntry::Symlink { ref target, .. } => Node::Symlink {
|
||||
target: bytes::Bytes::copy_from_slice(target).try_into().map_err(
|
||||
|e: crate::ValidateNodeError| {
|
||||
|e: SymlinkTargetError| {
|
||||
IngestionError::UploadDirectoryError(
|
||||
entry.path().to_owned(),
|
||||
crate::Error::StorageError(e.to_string()),
|
||||
crate::Error::StorageError(format!("invalid symlink target: {}", e)),
|
||||
)
|
||||
},
|
||||
)?,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue