Make already-claimed a 400

This commit is contained in:
asonix 2022-06-05 23:24:27 -05:00
parent 9cfc1ed733
commit dc73bdbad4
2 changed files with 6 additions and 2 deletions

View File

@ -81,6 +81,9 @@ pub(crate) enum UploadError {
#[error("No files present in upload")]
NoFiles,
#[error("Upload was already claimed")]
AlreadyClaimed,
#[error("Requested a file that doesn't exist")]
MissingAlias,
@ -154,6 +157,7 @@ impl ResponseError for Error {
| UploadError::NoFiles
| UploadError::Upload(_)
| UploadError::UnsupportedFormat
| UploadError::AlreadyClaimed
| UploadError::SilentVideoDisabled,
) => StatusCode::BAD_REQUEST,
Some(

View File

@ -298,13 +298,13 @@ impl UploadRepo for SledRepo {
return Ok(result.into());
}
} else {
return Err(UploadError::NoFiles.into());
return Err(UploadError::AlreadyClaimed.into());
}
while let Some(event) = (&mut subscriber).await {
match event {
sled::Event::Remove { .. } => {
return Err(UploadError::NoFiles.into());
return Err(UploadError::AlreadyClaimed.into());
}
sled::Event::Insert { value, .. } => {
if value != b"1" {