@@ -196,7 +196,7 @@ impl SourceExecutor for Executor {
196196 . doit ( )
197197 . await ?;
198198
199- let resp_body = if let Some ( export_mime_type) = file
199+ let ( mime_type , resp_body) = if let Some ( export_mime_type) = file
200200 . mime_type
201201 . as_ref ( )
202202 . and_then ( |mime_type| EXPORT_MIME_TYPES . get ( mime_type. as_str ( ) ) )
@@ -206,13 +206,15 @@ impl SourceExecutor for Executor {
206206 } else {
207207 export_mime_type. text
208208 } ;
209- self . drive_hub
209+ let content = self
210+ . drive_hub
210211 . files ( )
211212 . export ( & file_id, target_mime_type)
212213 . add_scope ( Scope :: Readonly )
213214 . doit ( )
214215 . await ?
215- . into_body ( )
216+ . into_body ( ) ;
217+ ( Some ( target_mime_type. to_string ( ) ) , content)
216218 } else {
217219 let ( resp, _) = self
218220 . drive_hub
@@ -222,11 +224,12 @@ impl SourceExecutor for Executor {
222224 . param ( "alt" , "media" )
223225 . doit ( )
224226 . await ?;
225- resp. into_body ( )
227+ ( file . mime_type , resp. into_body ( ) )
226228 } ;
227229 let content = resp_body. collect ( ) . await ?;
228230 let mut fields = Vec :: with_capacity ( 2 ) ;
229231 fields. push ( file. name . unwrap_or_default ( ) . into ( ) ) ;
232+ fields. push ( mime_type. into ( ) ) ;
230233 if self . binary {
231234 fields. push ( content. to_bytes ( ) . to_vec ( ) . into ( ) ) ;
232235 } else {
@@ -261,6 +264,7 @@ impl SourceFactoryBase for Factory {
261264 vec ! [
262265 FieldSchema :: new( "file_id" , make_output_type( BasicValueType :: Str ) ) ,
263266 FieldSchema :: new( "filename" , make_output_type( BasicValueType :: Str ) ) ,
267+ FieldSchema :: new( "mime_type" , make_output_type( BasicValueType :: Str ) ) ,
264268 FieldSchema :: new(
265269 "content" ,
266270 make_output_type( if spec. binary {
0 commit comments