File tree Expand file tree Collapse file tree
src/llm-coding-tools-core/src/tools/webfetch Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,17 @@ pub fn fetch_url(
3535 . to_string ( ) ;
3636
3737 // Check Content-Length header if available for early rejection and preallocation
38- let content_length = response. content_length ( ) . map ( |len| len as usize ) ;
38+ let content_length = response
39+ . content_length ( )
40+ . map ( |len| {
41+ usize:: try_from ( len) . map_err ( |_| {
42+ ToolError :: Http ( format ! (
43+ "Content-Length {} exceeds platform limits for {}" ,
44+ len, url
45+ ) )
46+ } )
47+ } )
48+ . transpose ( ) ?;
3949 if let Some ( len) = content_length {
4050 check_size ( len, url) ?;
4151 }
Original file line number Diff line number Diff line change @@ -36,7 +36,15 @@ pub async fn fetch_url(
3636 // Check Content-Length header if available for early rejection and preallocation
3737 let content_length = response
3838 . content_length ( )
39- . and_then ( |len| usize:: try_from ( len) . ok ( ) ) ;
39+ . map ( |len| {
40+ usize:: try_from ( len) . map_err ( |_| {
41+ ToolError :: Http ( format ! (
42+ "Content-Length {} exceeds platform limits for {}" ,
43+ len, url
44+ ) )
45+ } )
46+ } )
47+ . transpose ( ) ?;
4048 if let Some ( len) = content_length {
4149 check_size ( len, url) ?;
4250 }
You can’t perform that action at this time.
0 commit comments