Browse Source

Include actual limit in file size limit error message

Go returns "file over the limited %d bytes" with the actual limit
value included. Rust returned a generic "file size limit exceeded"
without the limit value, making it harder to debug.
rust-volume-server
Chris Lu 4 days ago
parent
commit
190c2dd1dd
  1. 7
      seaweed-volume/src/server/handlers.rs

7
seaweed-volume/src/server/handlers.rs

@ -2048,11 +2048,14 @@ pub async fn post_handler(
Some("1" | "t" | "T" | "TRUE" | "True" | "true")
);
// Check file size limit
// Check file size limit (matches Go: "file over the limited %d bytes")
if state.file_size_limit_bytes > 0 && body_data_raw.len() as i64 > state.file_size_limit_bytes {
return json_error_with_query(
StatusCode::BAD_REQUEST,
"file size limit exceeded",
format!(
"file over the limited {} bytes",
state.file_size_limit_bytes
),
Some(&query),
);
}

Loading…
Cancel
Save