mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 12:03:19 +00:00
fix: "zip" Content-Type resulting in null Stream for Artifacts on Blob Storage (#2905)
This commit is contained in:
@@ -81,7 +81,6 @@ namespace Octokit.Internal
|
||||
AcceptHeaders.RawContentMediaType,
|
||||
"application/zip" ,
|
||||
"application/x-gzip" ,
|
||||
"zip" , // Not a standard MIME type but see issue #2898
|
||||
"application/octet-stream"};
|
||||
|
||||
var content = responseMessage.Content;
|
||||
@@ -169,10 +168,18 @@ namespace Octokit.Internal
|
||||
|
||||
static string GetContentMediaType(HttpContent httpContent)
|
||||
{
|
||||
if (httpContent.Headers != null && httpContent.Headers.ContentType != null)
|
||||
if (httpContent.Headers?.ContentType != null)
|
||||
{
|
||||
return httpContent.Headers.ContentType.MediaType;
|
||||
}
|
||||
|
||||
// Issue #2898 - Bad "zip" Content-Type coming from Blob Storage for artifacts
|
||||
if (httpContent.Headers?.TryGetValues("Content-Type", out var contentTypeValues) == true
|
||||
&& contentTypeValues.FirstOrDefault() == "zip")
|
||||
{
|
||||
return "application/zip";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user