File tree Expand file tree Collapse file tree
src/Infrastructure/BotSharp.Abstraction/Files/Utilities Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,6 +65,19 @@ public static BinaryData BuildBinaryDataFromFile(IFormFile file)
6565
6666 public static string GetFileContentType ( string fileName )
6767 {
68+ if ( string . IsNullOrEmpty ( fileName ) )
69+ {
70+ return string . Empty ;
71+ }
72+
73+ // For URLs (e.g. signed S3/CloudFront URLs with query strings), extract the path portion
74+ // so that FileExtensionContentTypeProvider can correctly resolve the extension.
75+ if ( Uri . TryCreate ( fileName , UriKind . Absolute , out var uri )
76+ && ( uri . Scheme == Uri . UriSchemeHttp || uri . Scheme == Uri . UriSchemeHttps ) )
77+ {
78+ fileName = uri . AbsolutePath ;
79+ }
80+
6881 string contentType ;
6982 var provider = new FileExtensionContentTypeProvider ( ) ;
7083 if ( ! provider . TryGetContentType ( fileName , out contentType ) )
You can’t perform that action at this time.
0 commit comments