mirror of
https://github.com/getnora-io/nora.git
synced 2026-04-12 12:40:31 +00:00
fix: detect OCI manifest media type for Helm chart support
Distinguish OCI vs Docker manifests by checking config.mediaType instead of assuming all schemaVersion 2 manifests are Docker. Enables helm push/pull via OCI protocol. DevITWay
This commit is contained in:
@@ -748,8 +748,16 @@ fn detect_manifest_media_type(data: &[u8]) -> String {
|
|||||||
if schema_version == 1 {
|
if schema_version == 1 {
|
||||||
return "application/vnd.docker.distribution.manifest.v1+json".to_string();
|
return "application/vnd.docker.distribution.manifest.v1+json".to_string();
|
||||||
}
|
}
|
||||||
// schemaVersion 2 without mediaType is likely docker manifest v2
|
// schemaVersion 2 without mediaType - check config.mediaType to distinguish OCI vs Docker
|
||||||
if json.get("config").is_some() {
|
if let Some(config) = json.get("config") {
|
||||||
|
if let Some(config_mt) = config.get("mediaType").and_then(|v| v.as_str()) {
|
||||||
|
if config_mt.starts_with("application/vnd.docker.") {
|
||||||
|
return "application/vnd.docker.distribution.manifest.v2+json".to_string();
|
||||||
|
}
|
||||||
|
// OCI or Helm or any non-docker config mediaType
|
||||||
|
return "application/vnd.oci.image.manifest.v1+json".to_string();
|
||||||
|
}
|
||||||
|
// No config.mediaType - assume docker v2
|
||||||
return "application/vnd.docker.distribution.manifest.v2+json".to_string();
|
return "application/vnd.docker.distribution.manifest.v2+json".to_string();
|
||||||
}
|
}
|
||||||
// If it has "manifests" array, it's an index/list
|
// If it has "manifests" array, it's an index/list
|
||||||
|
|||||||
Reference in New Issue
Block a user