From af7530ee502fa0d172690b393d8b1bcb40c12564 Mon Sep 17 00:00:00 2001 From: Fedor Korotkov Date: Mon, 17 Oct 2022 13:42:25 -0400 Subject: [PATCH] Relax status code acceptance (#281) * Relax status code acceptance Fixes #273 * added a comment --- Sources/tart/OCI/Registry.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/tart/OCI/Registry.swift b/Sources/tart/OCI/Registry.swift index 5e465ec..cabf61c 100644 --- a/Sources/tart/OCI/Registry.swift +++ b/Sources/tart/OCI/Registry.swift @@ -214,8 +214,8 @@ class Registry { parameters: lastChunk ? ["digest": digest] : [:], body: chunk ) - let expectedStatus = lastChunk ? HTTPCode.Created.rawValue : HTTPCode.Accepted.rawValue - if response.statusCode != expectedStatus { + // always accept both statuses since AWS ECR is not following specification + if response.statusCode != HTTPCode.Created.rawValue && response.statusCode != HTTPCode.Accepted.rawValue { throw RegistryError.UnexpectedHTTPStatusCode(when: "streaming blob to \(uploadLocation)", code: response.statusCode, details: data.asText()) }