add: ability to manage uploads
This commit is contained in:
parent
6fabb38c10
commit
eb95be0f38
11 changed files with 234 additions and 48 deletions
|
@ -164,8 +164,8 @@ pub async fn banner_request(
|
|||
))
|
||||
}
|
||||
|
||||
pub static MAXIUMUM_FILE_SIZE: usize = 8388608;
|
||||
pub static MAXIUMUM_GIF_FILE_SIZE: usize = 2097152;
|
||||
pub static MAXIMUM_FILE_SIZE: usize = 8388608;
|
||||
pub static MAXIMUM_GIF_FILE_SIZE: usize = 2097152;
|
||||
|
||||
/// Upload avatar
|
||||
pub async fn upload_avatar_request(
|
||||
|
@ -223,7 +223,7 @@ pub async fn upload_avatar_request(
|
|||
// upload image (gif)
|
||||
if mime == "image/gif" {
|
||||
// gif image, don't encode
|
||||
if img.0.len() > MAXIUMUM_GIF_FILE_SIZE {
|
||||
if img.0.len() > MAXIMUM_GIF_FILE_SIZE {
|
||||
return Json(Error::DataTooLong("gif".to_string()).into());
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ pub async fn upload_avatar_request(
|
|||
}
|
||||
|
||||
// check file size
|
||||
if img.0.len() > MAXIUMUM_FILE_SIZE {
|
||||
if img.0.len() > MAXIMUM_FILE_SIZE {
|
||||
return Json(Error::DataTooLong("image".to_string()).into());
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ pub async fn upload_banner_request(
|
|||
// upload image (gif)
|
||||
if mime == "image/gif" {
|
||||
// gif image, don't encode
|
||||
if img.0.len() > MAXIUMUM_GIF_FILE_SIZE {
|
||||
if img.0.len() > MAXIMUM_GIF_FILE_SIZE {
|
||||
return Json(Error::DataTooLong("gif".to_string()).into());
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ pub async fn upload_banner_request(
|
|||
}
|
||||
|
||||
// check file size
|
||||
if img.0.len() > MAXIUMUM_FILE_SIZE {
|
||||
if img.0.len() > MAXIMUM_FILE_SIZE {
|
||||
return Json(Error::DataTooLong("image".to_string()).into());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue