Skip to content

Commit 4d6ad5f

Browse files
committed
fix method
1 parent a853946 commit 4d6ad5f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Microsoft.NET.Build.Containers/Registry.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,13 @@ private readonly async Task<UriBuilder> UploadBlobWhole(string name, string dige
225225
StreamContent content = new StreamContent(contents);
226226
content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
227227
content.Headers.ContentLength = contents.Length;
228-
HttpResponseMessage putResponse = await client.PutAsync(uploadUri.Uri, content);
229-
putResponse.EnsureSuccessStatusCode();
230-
return GetNextLocation(putResponse);
228+
HttpResponseMessage patchResponse = await client.PatchAsync(uploadUri.Uri, content);
229+
if (patchResponse.StatusCode != HttpStatusCode.Accepted)
230+
{
231+
string errorMessage = $"Failed to upload to {uploadUri}; received {patchResponse.StatusCode} with detail {await patchResponse.Content.ReadAsStringAsync()}";
232+
throw new ApplicationException(errorMessage);
233+
}
234+
return GetNextLocation(patchResponse);
231235
}
232236

233237
private readonly async Task<UriBuilder> StartUploadSession(string name, string digest, HttpClient client) {

0 commit comments

Comments
 (0)