File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -165,9 +165,9 @@ impl DataStorage for S3DataStorage {
165165 . put_multipart_chunk (
166166 bytes. to_vec ( ) ,
167167 & s3_path,
168- ( parts. len ( ) + 1 ) as u32 ,
168+ u32 :: try_from ( parts. len ( ) + 1 ) ? ,
169169 upload_id,
170- & content_type. to_string ( ) ,
170+ content_type. as_ref ( ) ,
171171 )
172172 . await ?;
173173 parts. push ( resp. into ( ) ) ;
@@ -192,10 +192,9 @@ impl DataStorage for S3DataStorage {
192192 async fn create_file ( & self , file_info : & mut FileInfo ) -> crate :: errors:: RustusResult < String > {
193193 let s3_path = self . get_s3_key ( & file_info. id , file_info. created_at ) ;
194194 let mime_type = mime_guess:: from_path ( file_info. get_filename ( ) ) . first_or_octet_stream ( ) ;
195- println ! ( "MIME TYPE: {}" , mime_type. to_string( ) ) ;
196195 let resp = self
197196 . bucket
198- . initiate_multipart_upload ( & s3_path, & mime_type. to_string ( ) )
197+ . initiate_multipart_upload ( & s3_path, mime_type. as_ref ( ) )
199198 . await ?;
200199 log:: debug!( "Created multipart upload with id: {}" , resp. upload_id) ;
201200 file_info
Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ pub enum RustusError {
7171 S3UploadIdMissing ,
7272 #[ error( "Can't parse integer: {0}" ) ]
7373 ParseIntError ( #[ from] std:: num:: ParseIntError ) ,
74+ #[ error( "Can't convert int: {0}" ) ]
75+ TryFromIntError ( #[ from] std:: num:: TryFromIntError ) ,
7476}
7577
7678/// This conversion allows us to use `RustusError` in the `main` function.
You can’t perform that action at this time.
0 commit comments