Skip to content

Commit a4c7c8e

Browse files
committed
fix: fix 100mb limit (lol)
1 parent ac04947 commit a4c7c8e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/types/mod_json.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use reqwest::Url;
1010
use semver::Version;
1111
use serde::Deserialize;
1212
use std::io::BufReader;
13+
use tokio::io::AsyncReadExt;
1314
use zip::read::ZipFile;
1415

1516
use super::{
@@ -95,9 +96,9 @@ impl ModJson {
9596
store_image: bool,
9697
) -> Result<ModJson, ApiError> {
9798
let mut bytes: Vec<u8> = vec![];
98-
match file.read_to_end(&mut bytes) {
99+
match file.take(&mut bytes, 100_000_000) {
99100
Err(e) => {
100-
log::error!("{}", e);
101+
log::error!("Failed to read bytes from {}: {}", download_url, e);
101102
return Err(ApiError::FilesystemError);
102103
}
103104
Ok(b) => b,

src/types/models/mod_entity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ impl Mod {
15031503

15041504
pub async fn download_geode_file(url: &str) -> Result<Cursor<Bytes>, ApiError> {
15051505
let size = get_download_size(url).await?;
1506-
if size > 1_000_000_000 {
1506+
if size > 100_000_000 {
15071507
return Err(ApiError::BadRequest(
15081508
"File size is too large, max 100MB".to_string(),
15091509
));

0 commit comments

Comments
 (0)