|
@@ -19,35 +19,36 @@ import (
|
|
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
|
|
)
|
|
|
|
|
|
-// ImageTypes represents the schema2 config types for images
|
|
|
-var ImageTypes = []string{
|
|
|
- schema2.MediaTypeImageConfig,
|
|
|
- ocispec.MediaTypeImageConfig,
|
|
|
- // Handle unexpected values from https://github.com/docker/distribution/issues/1621
|
|
|
- // (see also https://github.com/docker/docker/issues/22378,
|
|
|
- // https://github.com/docker/docker/issues/30083)
|
|
|
- "application/octet-stream",
|
|
|
- "application/json",
|
|
|
- "text/html",
|
|
|
- // Treat defaulted values as images, newer types cannot be implied
|
|
|
- "",
|
|
|
-}
|
|
|
+var (
|
|
|
+ // defaultImageTypes represents the schema2 config types for images
|
|
|
+ defaultImageTypes = []string{
|
|
|
+ schema2.MediaTypeImageConfig,
|
|
|
+ ocispec.MediaTypeImageConfig,
|
|
|
+ // Handle unexpected values from https://github.com/docker/distribution/issues/1621
|
|
|
+ // (see also https://github.com/docker/docker/issues/22378,
|
|
|
+ // https://github.com/docker/docker/issues/30083)
|
|
|
+ "application/octet-stream",
|
|
|
+ "application/json",
|
|
|
+ "text/html",
|
|
|
+ // Treat defaulted values as images, newer types cannot be implied
|
|
|
+ "",
|
|
|
+ }
|
|
|
|
|
|
-// PluginTypes represents the schema2 config types for plugins
|
|
|
-var PluginTypes = []string{
|
|
|
- schema2.MediaTypePluginConfig,
|
|
|
-}
|
|
|
+ // pluginTypes represents the schema2 config types for plugins
|
|
|
+ pluginTypes = []string{
|
|
|
+ schema2.MediaTypePluginConfig,
|
|
|
+ }
|
|
|
|
|
|
-var mediaTypeClasses map[string]string
|
|
|
+ mediaTypeClasses map[string]string
|
|
|
+)
|
|
|
|
|
|
func init() {
|
|
|
- // initialize media type classes with all know types for
|
|
|
- // plugin
|
|
|
+ // initialize media type classes with all know types for images and plugins.
|
|
|
mediaTypeClasses = map[string]string{}
|
|
|
- for _, t := range ImageTypes {
|
|
|
+ for _, t := range defaultImageTypes {
|
|
|
mediaTypeClasses[t] = "image"
|
|
|
}
|
|
|
- for _, t := range PluginTypes {
|
|
|
+ for _, t := range pluginTypes {
|
|
|
mediaTypeClasses[t] = "plugin"
|
|
|
}
|
|
|
}
|