Skip to content

Commit 25b6477

Browse files
committed
Support alternative media type format
Update `ExportedImageTar` media type detection to support `tar+gzip` as well as `tar.gzip`. Recent updates to Docker Desktop appear to have changed the format. Fixes gh-43126
1 parent a293560 commit 25b6477

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ExportedImageTar.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@ TarArchive getLayerArchive(TarArchiveInputStream tar, TarArchiveEntry entry) {
247247
}
248248

249249
private Compression getCompression(String mediaType) {
250-
if (mediaType.endsWith(".tar.gzip")) {
250+
if (mediaType.endsWith(".tar.gzip") || mediaType.endsWith(".tar+gzip")) {
251251
return Compression.GZIP;
252252
}
253-
if (mediaType.endsWith(".tar.zstd")) {
253+
if (mediaType.endsWith(".tar.zstd") || mediaType.endsWith(".tar+zstd")) {
254254
return Compression.ZSTD;
255255
}
256256
return Compression.NONE;

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/ExportedImageTarTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ExportedImageTarTests {
3838
@ParameterizedTest
3939
@ValueSource(strings = { "export-docker-desktop.tar", "export-docker-desktop-containerd.tar",
4040
"export-docker-desktop-containerd-manifest-list.tar", "export-docker-engine.tar", "export-podman.tar",
41-
"export-docker-desktop-nested-index.tar" })
41+
"export-docker-desktop-nested-index.tar", "export-docker-desktop-containerd-alt-mediatype.tar" })
4242
void test(String tarFile) throws Exception {
4343
ImageReference reference = ImageReference.of("test:latest");
4444
try (ExportedImageTar exportedImageTar = new ExportedImageTar(reference,

0 commit comments

Comments
 (0)