In NewV2Repository, check the suffix of endpoint.URL and append 'v2' correctly.

Signed-off-by: yuzou <zouyu7@huawei.com>
Upstream-commit: 5f59f52c1413087735852a038ee459833734d8a2
Component: engine
This commit is contained in:
yuzou
2015-10-21 11:43:31 +08:00
parent ebd613a0a8
commit 9bceeb4321
+2 -1
View File
@@ -17,6 +17,7 @@ import (
"github.com/docker/docker/cliconfig"
"github.com/docker/docker/registry"
"golang.org/x/net/context"
"strings"
)
type dumbCredentialStore struct {
@@ -59,7 +60,7 @@ func NewV2Repository(repoInfo *registry.RepositoryInfo, endpoint registry.APIEnd
Transport: authTransport,
Timeout: 15 * time.Second,
}
endpointStr := endpoint.URL + "/v2/"
endpointStr := strings.TrimRight(endpoint.URL, "/") + "/v2/"
req, err := http.NewRequest("GET", endpointStr, nil)
if err != nil {
return nil, err