Skip to content

Commit

Permalink
warn on file size
Browse files Browse the repository at this point in the history
  • Loading branch information
dadleyy committed Nov 1, 2023
1 parent 89c3f74 commit 6024afe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/beetle-srv/src/api/jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@ pub async fn queue(mut request: tide::Request<super::worker::Worker>) -> tide::R
}
}

let size = request
.len()
.ok_or_else(|| tide::Error::from_str(422, "missing image upload size"))?;
let size = request.len().ok_or_else(|| {
log::warn!("unable to determine image size from upload");
tide::Error::from_str(422, "missing image upload size")
})?;

if size > 800000usize {
log::warn!("invalid image upload size: '{size}'");
return Err(tide::Error::from_str(422, "image too large"));
}

Expand Down

0 comments on commit 6024afe

Please sign in to comment.