mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2024-11-28 20:41: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")]
|
#[error("No files present in upload")]
|
||||||
NoFiles,
|
NoFiles,
|
||||||
|
|
||||||
|
#[error("Upload was already claimed")]
|
||||||
|
AlreadyClaimed,
|
||||||
|
|
||||||
#[error("Requested a file that doesn't exist")]
|
#[error("Requested a file that doesn't exist")]
|
||||||
MissingAlias,
|
MissingAlias,
|
||||||
|
|
||||||
|
@ -154,6 +157,7 @@ impl ResponseError for Error {
|
||||||
| UploadError::NoFiles
|
| UploadError::NoFiles
|
||||||
| UploadError::Upload(_)
|
| UploadError::Upload(_)
|
||||||
| UploadError::UnsupportedFormat
|
| UploadError::UnsupportedFormat
|
||||||
|
| UploadError::AlreadyClaimed
|
||||||
| UploadError::SilentVideoDisabled,
|
| UploadError::SilentVideoDisabled,
|
||||||
) => StatusCode::BAD_REQUEST,
|
) => StatusCode::BAD_REQUEST,
|
||||||
Some(
|
Some(
|
||||||
|
|
|
@ -298,13 +298,13 @@ impl UploadRepo for SledRepo {
|
||||||
return Ok(result.into());
|
return Ok(result.into());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(UploadError::NoFiles.into());
|
return Err(UploadError::AlreadyClaimed.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(event) = (&mut subscriber).await {
|
while let Some(event) = (&mut subscriber).await {
|
||||||
match event {
|
match event {
|
||||||
sled::Event::Remove { .. } => {
|
sled::Event::Remove { .. } => {
|
||||||
return Err(UploadError::NoFiles.into());
|
return Err(UploadError::AlreadyClaimed.into());
|
||||||
}
|
}
|
||||||
sled::Event::Insert { value, .. } => {
|
sled::Event::Insert { value, .. } => {
|
||||||
if value != b"1" {
|
if value != b"1" {
|
||||||
|
|
Loading…
Reference in a new issue