set error message

This commit is contained in:
slonkazoid 2025-01-30 20:20:42 +03:00
parent d1731fb01d
commit 02496d220a
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM

View file

@ -21,7 +21,7 @@ where
let s = Path::<T>::from_request_parts(parts, state).await?.0; let s = Path::<T>::from_request_parts(parts, state).await?.0;
if s.as_ref().contains("..") || s.as_ref().contains('/') { if s.as_ref().contains("..") || s.as_ref().contains('/') {
return Err(SafePathRejection::Test); return Err(SafePathRejection::Invalid);
} }
Ok(SafePath(s)) Ok(SafePath(s))
@ -30,8 +30,8 @@ where
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum SafePathRejection { pub enum SafePathRejection {
#[error("test")] #[error("path contains invalid characters")]
Test, Invalid,
#[error(transparent)] #[error(transparent)]
PathRejection(#[from] PathRejection), PathRejection(#[from] PathRejection),
} }