mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: Client.ImageHistory: don't decorate error twice
I forgot to include this patch in 96039276b6,
which introduced the encodePlatform, which already decorates the error to
have a `invalid platform:` prefix.
While updating, also be more explicit on no result being returned on error.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -3,7 +3,6 @@ package client // import "github.com/docker/docker/client"
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"github.com/docker/docker/api/types/image"
|
||||
@@ -19,18 +18,18 @@ func (cli *Client) ImageHistory(ctx context.Context, imageID string, opts image.
|
||||
|
||||
p, err := encodePlatform(opts.Platform)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid platform: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
query.Set("platform", p)
|
||||
}
|
||||
|
||||
var history []image.HistoryResponseItem
|
||||
serverResp, err := cli.get(ctx, "/images/"+imageID+"/history", query, nil)
|
||||
defer ensureReaderClosed(serverResp)
|
||||
if err != nil {
|
||||
return history, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var history []image.HistoryResponseItem
|
||||
err = json.NewDecoder(serverResp.body).Decode(&history)
|
||||
return history, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user