Open IIEIIEJI opened 2 months ago
Looks like you are correct here! Code also looks pretty good with the only suggestion being to check the response headers to see if content-type is set before parsing JSON. Completely open to a PR if you'd like to submit!
Hello!. Maybe, in the _validate_registryresponse function, there is a non-compliance with the https://github.com/opencontainers/distribution-spec/blob/main/spec.md#errors-2 standard. Firstly the returned format may not be json ( ...A 4XX response code from the registry MAY return a body in any format....). Secondly some registries return their own code, for example Harbor v2.9.0 returns this error: r#"{"errors":[{"code": "NOT_FOUND", "message": "artifact image:0.0.1 not found"}]}]}"#. It may be more correct to use the following variant of the _validate_registryresponse function: