From 4883a34ddb0db57240e3d4cd3904d35dbdfb410b Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Wed, 7 Aug 2024 15:09:40 +0200 Subject: [PATCH 1/2] Add support for binary/octet-stream. Quay.io responds with binary/octet-stream when reading imageBlob. application/octet-stream is identical to binary/octet-stream. Fixes #5885 --- .../container/registry/ContainerImageRestTemplateFactory.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-cloud-dataflow-container-registry/src/main/java/org/springframework/cloud/dataflow/container/registry/ContainerImageRestTemplateFactory.java b/spring-cloud-dataflow-container-registry/src/main/java/org/springframework/cloud/dataflow/container/registry/ContainerImageRestTemplateFactory.java index 2fc476bd6a..007bad1105 100644 --- a/spring-cloud-dataflow-container-registry/src/main/java/org/springframework/cloud/dataflow/container/registry/ContainerImageRestTemplateFactory.java +++ b/spring-cloud-dataflow-container-registry/src/main/java/org/springframework/cloud/dataflow/container/registry/ContainerImageRestTemplateFactory.java @@ -210,6 +210,7 @@ private RestTemplate initRestTemplate(HttpClientBuilder clientBuilder, boolean w ArrayList mediaTypeList = new ArrayList(octetSupportJsonConverter.getSupportedMediaTypes()); mediaTypeList.add(MediaType.APPLICATION_OCTET_STREAM); mediaTypeList.add(MediaType.TEXT_PLAIN); + mediaTypeList.add(MediaType.parseMediaType("binary/octet-stream")); // quay.io responds with binary/octet-stream instead of application/octet-stream octetSupportJsonConverter.setSupportedMediaTypes(mediaTypeList); return restTemplateBuilder From 49827e0b60dbcc7e2101bf14678d81efa4812938 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Thu, 22 Aug 2024 16:07:05 +0200 Subject: [PATCH 2/2] Updated comment --- .../registry/ContainerImageRestTemplateFactory.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-cloud-dataflow-container-registry/src/main/java/org/springframework/cloud/dataflow/container/registry/ContainerImageRestTemplateFactory.java b/spring-cloud-dataflow-container-registry/src/main/java/org/springframework/cloud/dataflow/container/registry/ContainerImageRestTemplateFactory.java index 007bad1105..7d9f88acbc 100644 --- a/spring-cloud-dataflow-container-registry/src/main/java/org/springframework/cloud/dataflow/container/registry/ContainerImageRestTemplateFactory.java +++ b/spring-cloud-dataflow-container-registry/src/main/java/org/springframework/cloud/dataflow/container/registry/ContainerImageRestTemplateFactory.java @@ -202,10 +202,10 @@ private RestTemplate initRestTemplate(HttpClientBuilder clientBuilder, boolean w .setDefaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()) .build()); - // DockerHub response's media-type is application/octet-stream although the content is in JSON. - // Similarly the Github CR response's media-type is always text/plain although the content is in JSON. - // Therefore we extend the MappingJackson2HttpMessageConverter media-types to - // include application/octet-stream and text/plain. + // Extend the MappingJackson2HttpMessageConverter to support the following: + // - DockerHub response media-type is application/octet-stream although the content is in JSON + // - Github CR response media-type is text/plain although the content is in JSON + // - quay.io response media-type is binary/octet-stream although the content is in JSON MappingJackson2HttpMessageConverter octetSupportJsonConverter = new MappingJackson2HttpMessageConverter(); ArrayList mediaTypeList = new ArrayList(octetSupportJsonConverter.getSupportedMediaTypes()); mediaTypeList.add(MediaType.APPLICATION_OCTET_STREAM);