File tree 2 files changed +4
-3
lines changed
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use reqwest::Url;
10
10
use semver:: Version ;
11
11
use serde:: Deserialize ;
12
12
use std:: io:: BufReader ;
13
+ use tokio:: io:: AsyncReadExt ;
13
14
use zip:: read:: ZipFile ;
14
15
15
16
use super :: {
@@ -95,9 +96,9 @@ impl ModJson {
95
96
store_image : bool ,
96
97
) -> Result < ModJson , ApiError > {
97
98
let mut bytes: Vec < u8 > = vec ! [ ] ;
98
- match file. read_to_end ( & mut bytes) {
99
+ match file. take ( & mut bytes, 100_000_000 ) {
99
100
Err ( e) => {
100
- log:: error!( "{}" , e) ;
101
+ log:: error!( "Failed to read bytes from {}: {}" , download_url , e) ;
101
102
return Err ( ApiError :: FilesystemError ) ;
102
103
}
103
104
Ok ( b) => b,
Original file line number Diff line number Diff line change @@ -1503,7 +1503,7 @@ impl Mod {
1503
1503
1504
1504
pub async fn download_geode_file ( url : & str ) -> Result < Cursor < Bytes > , ApiError > {
1505
1505
let size = get_download_size ( url) . await ?;
1506
- if size > 1_000_000_000 {
1506
+ if size > 100_000_000 {
1507
1507
return Err ( ApiError :: BadRequest (
1508
1508
"File size is too large, max 100MB" . to_string ( ) ,
1509
1509
) ) ;
You can’t perform that action at this time.
0 commit comments