mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2024-11-28 12:31:00 +00:00
Make already-claimed a 400
This commit is contained in:
parent
9cfc1ed733
commit
dc73bdbad4
2 changed files with 6 additions and 2 deletions
|
@ -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(
|
||||
|
|
|
@ -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" {
|
||||
|
|
Loading…
Reference in a new issue