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
This commit is contained in:
parent
a293560237
commit
25b6477aa8
|
@ -247,10 +247,10 @@ class ExportedImageTar implements Closeable {
|
|||
}
|
||||
|
||||
private Compression getCompression(String mediaType) {
|
||||
if (mediaType.endsWith(".tar.gzip")) {
|
||||
if (mediaType.endsWith(".tar.gzip") || mediaType.endsWith(".tar+gzip")) {
|
||||
return Compression.GZIP;
|
||||
}
|
||||
if (mediaType.endsWith(".tar.zstd")) {
|
||||
if (mediaType.endsWith(".tar.zstd") || mediaType.endsWith(".tar+zstd")) {
|
||||
return Compression.ZSTD;
|
||||
}
|
||||
return Compression.NONE;
|
||||
|
|
|
@ -38,7 +38,7 @@ class ExportedImageTarTests {
|
|||
@ParameterizedTest
|
||||
@ValueSource(strings = { "export-docker-desktop.tar", "export-docker-desktop-containerd.tar",
|
||||
"export-docker-desktop-containerd-manifest-list.tar", "export-docker-engine.tar", "export-podman.tar",
|
||||
"export-docker-desktop-nested-index.tar" })
|
||||
"export-docker-desktop-nested-index.tar", "export-docker-desktop-containerd-alt-mediatype.tar" })
|
||||
void test(String tarFile) throws Exception {
|
||||
ImageReference reference = ImageReference.of("test:latest");
|
||||
try (ExportedImageTar exportedImageTar = new ExportedImageTar(reference,
|
||||
|
|
Loading…
Reference in New Issue