Skip to content

Commit 711b3d1

Browse files
authored
Update src/Microsoft.OpenApi/Reader/OpenApiModelFactory.cs
1 parent d5517ad commit 711b3d1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Microsoft.OpenApi/Reader/OpenApiModelFactory.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,8 @@ private static ReadResult InternalLoad(MemoryStream input, string format, OpenAp
298298
var response = await _httpClient.GetAsync(url, token).ConfigureAwait(false);
299299
var mediaType = response.Content.Headers.ContentType.MediaType;
300300
var contentType = mediaType.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)[0];
301-
format = contentType.Split('/').LastOrDefault();
302-
if (!string.IsNullOrEmpty(format) && format.Contains('-'))
303-
{
304-
format = format.Split('-').LastOrDefault(); // for non-standard MIME types e.g. text/x-yaml used in older libs or apps
305-
}
301+
format = contentType.Split('/').Last().Split('+').Last().Split('-').Last();
302+
// for non-standard MIME types e.g. text/x-yaml used in older libs or apps
306303
#if NETSTANDARD2_0
307304
stream = await response.Content.ReadAsStreamAsync();
308305
#else

0 commit comments

Comments
 (0)