@@ -60,6 +60,14 @@ class BaseContainerRegistry(metaclass=ABCMeta):
60
60
)
61
61
MEDIA_TYPE_DOCKER_MANIFEST : Final [str ] = "application/vnd.docker.distribution.manifest.v2+json"
62
62
63
+ # Legacy manifest types (deprecated)
64
+ MEDIA_TYPE_DOCKER_MANIFEST_V1_PRETTY_JWS : Final [str ] = (
65
+ "application/vnd.docker.distribution.manifest.v1+prettyjws"
66
+ )
67
+ MEDIA_TYPE_DOCKER_MANIFEST_V1_JSON : Final [str ] = (
68
+ "application/vnd.docker.distribution.manifest.v1+json"
69
+ )
70
+
63
71
def __init__ (
64
72
self ,
65
73
db : ExtendedAsyncSAEngine ,
@@ -279,7 +287,7 @@ async def _scan_tag(
279
287
return
280
288
content_type = resp .headers ["Content-Type" ]
281
289
resp .raise_for_status ()
282
- resp_json = await resp .json ( )
290
+ resp_json = json . loads ( await resp .read () )
283
291
284
292
async with aiotools .TaskGroup () as tg :
285
293
match content_type :
@@ -295,6 +303,14 @@ async def _scan_tag(
295
303
await self ._process_oci_index (
296
304
tg , sess , rqst_args , image , tag , resp_json
297
305
)
306
+ case (
307
+ self .MEDIA_TYPE_DOCKER_MANIFEST_V1_PRETTY_JWS
308
+ | self .MEDIA_TYPE_DOCKER_MANIFEST_V1_JSON
309
+ ):
310
+ await self ._process_docker_v1_image (
311
+ tg , sess , rqst_args , image , tag , resp_json
312
+ )
313
+
298
314
case _:
299
315
log .warn ("Unknown content type: {}" , content_type )
300
316
raise RuntimeError (
@@ -438,6 +454,32 @@ async def _process_docker_v2_image(
438
454
}
439
455
await self ._read_manifest (image , tag , manifests )
440
456
457
+ async def _process_docker_v1_image (
458
+ self ,
459
+ tg : aiotools .TaskGroup ,
460
+ sess : aiohttp .ClientSession ,
461
+ rqst_args : Mapping [str , Any ],
462
+ image : str ,
463
+ tag : str ,
464
+ image_info : Mapping [str , Any ],
465
+ ) -> None :
466
+ log .warning ("Docker image manifest v1 is deprecated." )
467
+
468
+ architecture = image_info ["architecture" ]
469
+
470
+ manifest_list = [
471
+ {
472
+ "platform" : {
473
+ "os" : "linux" ,
474
+ "architecture" : architecture ,
475
+ },
476
+ "digest" : tag ,
477
+ }
478
+ ]
479
+
480
+ rqst_args ["headers" ]["Accept" ] = self .MEDIA_TYPE_DOCKER_MANIFEST
481
+ await self ._read_manifest_list (sess , manifest_list , rqst_args , image , tag )
482
+
441
483
async def _read_manifest (
442
484
self ,
443
485
image : str ,
0 commit comments