diff --git a/seaweed-volume/src/server/handlers.rs b/seaweed-volume/src/server/handlers.rs index 29cdd90ba..d5623e686 100644 --- a/seaweed-volume/src/server/handlers.rs +++ b/seaweed-volume/src/server/handlers.rs @@ -1753,8 +1753,16 @@ fn maybe_resize_image(data: &[u8], ext: &str, query: &ReadQueryParams) -> Vec Vec { - let (x1, y1, x2, y2) = match (query.crop_x1, query.crop_y1, query.crop_x2, query.crop_y2) { - (Some(x1), Some(y1), Some(x2), Some(y2)) if x2 > x1 && y2 > y1 => (x1, y1, x2, y2), + let (x1, y1, x2, y2) = match (query.crop_x2, query.crop_y2) { + (Some(x2), Some(y2)) => { + let x1 = query.crop_x1.unwrap_or(0); + let y1 = query.crop_y1.unwrap_or(0); + if x2 > x1 && y2 > y1 { + (x1, y1, x2, y2) + } else { + return data.to_vec(); + } + } _ => return data.to_vec(), };