@@ -808,7 +808,7 @@ fn resolve_upload_mime(
808808 }
809809
810810 if let Some ( path) = upload_path {
811- if let Some ( detected) = mime_from_extension ( path) {
811+ if let Some ( detected) = mime_guess2 :: from_path ( path) . first ( ) {
812812 return detected. to_string ( ) ;
813813 }
814814 }
@@ -824,33 +824,6 @@ fn resolve_upload_mime(
824824 "application/octet-stream" . to_string ( )
825825}
826826
827- /// Infers a MIME type from a file path's extension.
828- fn mime_from_extension ( path : & str ) -> Option < & ' static str > {
829- let ext = std:: path:: Path :: new ( path)
830- . extension ( )
831- . and_then ( |e| e. to_str ( ) ) ?;
832- match ext. to_lowercase ( ) . as_str ( ) {
833- "md" | "markdown" => Some ( "text/markdown" ) ,
834- "html" | "htm" => Some ( "text/html" ) ,
835- "txt" => Some ( "text/plain" ) ,
836- "json" => Some ( "application/json" ) ,
837- "csv" => Some ( "text/csv" ) ,
838- "xml" => Some ( "application/xml" ) ,
839- "pdf" => Some ( "application/pdf" ) ,
840- "png" => Some ( "image/png" ) ,
841- "jpg" | "jpeg" => Some ( "image/jpeg" ) ,
842- "gif" => Some ( "image/gif" ) ,
843- "svg" => Some ( "image/svg+xml" ) ,
844- "doc" => Some ( "application/msword" ) ,
845- "docx" => Some ( "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ) ,
846- "xls" => Some ( "application/vnd.ms-excel" ) ,
847- "xlsx" => Some ( "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ) ,
848- "ppt" => Some ( "application/vnd.ms-powerpoint" ) ,
849- "pptx" => Some ( "application/vnd.openxmlformats-officedocument.presentationml.presentation" ) ,
850- _ => None ,
851- }
852- }
853-
854827/// Builds a streaming multipart/related body for media upload requests.
855828///
856829/// Instead of reading the entire file into memory, this streams the file in
0 commit comments