File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Sources/ContainerRegistry Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,14 @@ public extension RegistryClient {
2929 decodingErrors: [ . notFound]
3030 )
3131
32- guard let location = httpResponse. response. headerFields [ . location] else {
33- throw HTTPClientError . missingResponseHeader ( " Location " )
34- }
35- return location
32+ // The distribution spec says the response MUST contain a Location header
33+ // providing a URL from which the saved manifest can be downloaded.
34+ // However some registries return URLs which cannot be fetched, and
35+ // ECR does not set this header at all.
36+ // If the header is not present, create a suitable value.
37+ // https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pulling-manifests
38+ return try httpResponse. response. headerFields [ . location]
39+ ?? registryURLForPath ( " /v2/ \( repository) /manifests/ \( manifest. digest) " ) . absoluteString
3640 }
3741
3842 func getManifest( repository: String , reference: String ) async throws -> ImageManifest {
You can’t perform that action at this time.
0 commit comments