mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 20:09:48 -05:00
parent
d02865b956
commit
60c25e2fbc
1 changed files with 4 additions and 4 deletions
|
@ -51,12 +51,12 @@ async fn upload(
|
|||
let mut bytes = Vec::<u8>::new();
|
||||
while let Some(chunk) = field.next().await {
|
||||
bytes.append(&mut chunk?.to_vec());
|
||||
}
|
||||
let bytes_unit = Byte::from_bytes(bytes.len() as u128).get_appropriate_unit(false);
|
||||
if bytes.len() as u128 > config.server.max_content_length.get_bytes() {
|
||||
log::warn!("upload rejected for {} ({})", host, bytes_unit);
|
||||
log::warn!("upload rejected for {}", host);
|
||||
return Err(error::ErrorPayloadTooLarge("upload limit exceeded"));
|
||||
}
|
||||
}
|
||||
let bytes_unit = Byte::from_bytes(bytes.len() as u128).get_appropriate_unit(false);
|
||||
let file_name = &file::save(content.get_file_name()?, &bytes, &config)?;
|
||||
log::info!("{} ({}) is uploaded from {}", file_name, bytes_unit, host);
|
||||
urls.push(format!(
|
||||
|
|
Loading…
Reference in a new issue