Skip to content

Commit

Permalink
Add check for blobs that are too large.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmiegit committed Oct 3, 2024
1 parent e79f766 commit a3b3be7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion deepwell/src/services/blob/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,16 @@ impl BlobService {
let config = ctx.config();
let txn = ctx.transaction();

// Convert expected length integer type
// Convert expected length integer type, then check it
let blob_size = i64::try_from(blob_size).map_err(|_| Error::BlobTooBig)?;
if blob_size > config.maximum_blob_size {
error!(
"Blob proposed to upload is too big ({} > {})",
blob_size, config.maximum_blob_size,
);

return Err(Error::BlobTooBig);
}

// Generate primary key and random S3 path
let pending_blob_id = cuid();
Expand Down

0 comments on commit a3b3be7

Please sign in to comment.