Skip to content

Commit

Permalink
manifest: removed legacy uncompressed JSON support
Browse files Browse the repository at this point in the history
  • Loading branch information
jkowalski committed Jan 21, 2019
1 parent 3377e40 commit 1803057
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions manifest/manifest_manager.go
Expand Up @@ -392,19 +392,13 @@ func (m *Manager) loadManifestBlock(ctx context.Context, blockID string) (manife
return man, err
}

if len(blk) > 2 && blk[0] == '{' {
if err := json.Unmarshal(blk, &man); err != nil {
return man, fmt.Errorf("unable to parse block %q: %v", blockID, err)
}
} else {
gz, err := gzip.NewReader(bytes.NewReader(blk))
if err != nil {
return man, fmt.Errorf("unable to unpack block %q: %v", blockID, err)
}
gz, err := gzip.NewReader(bytes.NewReader(blk))
if err != nil {
return man, fmt.Errorf("unable to unpack block %q: %v", blockID, err)
}

if err := json.NewDecoder(gz).Decode(&man); err != nil {
return man, fmt.Errorf("unable to parse block %q: %v", blockID, err)
}
if err := json.NewDecoder(gz).Decode(&man); err != nil {
return man, fmt.Errorf("unable to parse block %q: %v", blockID, err)
}

return man, nil
Expand Down

0 comments on commit 1803057

Please sign in to comment.