Skip to content

Commit

Permalink
some other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fleeym committed Jun 15, 2024
1 parent 82eccbf commit 5acac41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/endpoints/mods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,7 @@ pub async fn get_logo(
match image {
Some(i) => {
if i.is_empty() {
Ok(HttpResponse::NotFound().json(web::Json(ApiResponse {
error: "Not found".to_string(),
payload: "".to_string(),
})))
Ok(HttpResponse::NotFound().body(""))
} else {
Ok(HttpResponse::Ok().content_type("image/png").body(i))
}
Expand Down
4 changes: 2 additions & 2 deletions src/types/mod_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ pub fn validate_mod_logo(file: &mut ZipFile, return_bytes: bool) -> Result<Vec<u
return Err(ApiError::BadRequest("Invalid logo.png".to_string()));
}
};
let img = match DynamicImage::from_decoder(decoder) {
let mut img = match DynamicImage::from_decoder(decoder) {
Ok(i) => i,
Err(e) => {
log::error!("{}", e);
Expand All @@ -404,7 +404,7 @@ pub fn validate_mod_logo(file: &mut ZipFile, return_bytes: bool) -> Result<Vec<u
}

if (dimensions.0 > 336) || (dimensions.1 > 336) {
img.resize(336, 336, image::imageops::FilterType::Lanczos3);
img = img.resize(336, 336, image::imageops::FilterType::Lanczos3);
}

if !return_bytes {
Expand Down

0 comments on commit 5acac41

Please sign in to comment.