From 8d54e7c9445004bffa38ac798cf984bb243c2d73 Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Fri, 22 Jun 2018 12:03:17 -0700 Subject: [PATCH] [HACK] Fix for #1135 --- .../docker/distribution/manifest/schema2/manifest.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vendor/github.com/docker/distribution/manifest/schema2/manifest.go b/vendor/github.com/docker/distribution/manifest/schema2/manifest.go index a2708c75098e..0cb6274eaf87 100644 --- a/vendor/github.com/docker/distribution/manifest/schema2/manifest.go +++ b/vendor/github.com/docker/distribution/manifest/schema2/manifest.go @@ -106,13 +106,15 @@ func FromStruct(m Manifest) (*DeserializedManifest, error) { // UnmarshalJSON populates a new Manifest struct from JSON data. func (m *DeserializedManifest) UnmarshalJSON(b []byte) error { - m.canonical = make([]byte, len(b), len(b)) - // store manifest in canonical - copy(m.canonical, b) - // Unmarshal canonical JSON into Manifest object var manifest Manifest - if err := json.Unmarshal(m.canonical, &manifest); err != nil { + if err := json.Unmarshal(b, &manifest); err != nil { + return err + } + + var err error + m.canonical, err = json.MarshalIndent(&manifest, "", " ") + if err != nil { return err }