@@ -144,6 +144,29 @@ func Test_tryRemote(t *testing.T) {
144144 },
145145 wantErr : "unsupported artifact type" ,
146146 },
147+ {
148+ // Regression test: a single-arch image manifest (as opposed to a
149+ // multi-arch manifest list/index) has a Config field, and when the
150+ // manifest itself doesn't set an explicit `artifactType`,
151+ // go-containerregistry falls back to using the config's media type
152+ // as the descriptor's ArtifactType. A regular container image config
153+ // media type must NOT be treated as an unsupported artifact type.
154+ name : "regular image with explicit docker config media type" ,
155+ imageName : "test/dockerconfig:latest" ,
156+ setupImage : func (t * testing.T , ref name.Reference ) {
157+ configFile , err := img .ConfigFile ()
158+ require .NoError (t , err )
159+
160+ imageToWrite , err := mutate .Config (img , configFile .Config )
161+ require .NoError (t , err )
162+
163+ imageToWrite = mutate .ConfigMediaType (imageToWrite , "application/vnd.docker.container.image.v1+json" )
164+
165+ err = remote .Write (ref , imageToWrite )
166+ require .NoError (t , err )
167+ },
168+ wantName : "/test/dockerconfig:latest" ,
169+ },
147170 {
148171 name : "image not found" ,
149172 imageName : "test/notfound:latest" ,
0 commit comments