File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -62,10 +62,11 @@ async fn resolve_http(request: &Request, state: Data<&State>) -> impl IntoRespon
62
62
63
63
// stream file from s3 storage and return it
64
64
let s3_path = deployment_file. file_hash . clone ( ) ;
65
- if let Ok ( s3_data) = state. storage . bucket . get_object_stream ( s3_path) . await {
66
- // Stream the S3 response bytes directly to the client
67
- let stream = s3_data. bytes . map ( |chunk| {
68
- chunk. map_err ( |e| {
65
+ match state. storage . bucket . get_object_stream ( s3_path) . await {
66
+ Ok ( s3_data) => {
67
+ // Stream the S3 response bytes directly to the client
68
+ let stream = s3_data. bytes . map ( |chunk| {
69
+ chunk. map_err ( |e| {
69
70
info ! ( "Error streaming file: {}" , e) ;
70
71
std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , e)
71
72
} )
@@ -76,8 +77,14 @@ async fn resolve_http(request: &Request, state: Data<&State>) -> impl IntoRespon
76
77
. status ( StatusCode :: OK )
77
78
. header ( "content-type" , deployment_file. deployment_file_mime_type . clone ( ) )
78
79
. body ( body) ;
79
- } else {
80
- info ! ( "File not found in s3" ) ;
80
+ }
81
+ Err ( e) => {
82
+ info ! ( "Error streaming file: {}" , e) ;
83
+
84
+ return Response :: builder ( )
85
+ . status ( StatusCode :: INTERNAL_SERVER_ERROR )
86
+ . body ( Body :: from_string ( e. to_string ( ) ) )
87
+ }
81
88
}
82
89
} else {
83
90
info ! ( "No file found" ) ;
You can’t perform that action at this time.
0 commit comments