working commit
This commit is contained in:
+3
-13
@@ -7,19 +7,18 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func (cli *Client) ManifestExists(ctx context.Context, rawref string) (bool, string, int64, string, error) {
|
||||
func (cli *Client) ManifestExists(ctx context.Context, rawrepo, tag string) (bool, string, int64, string, error) {
|
||||
var err error
|
||||
var exist bool
|
||||
var mime string
|
||||
var size int64
|
||||
var csum string
|
||||
|
||||
ref, err := NewReference(rawref)
|
||||
ref, err := NewRepository(rawrepo)
|
||||
if err != nil {
|
||||
return exist, mime, size, csum, err
|
||||
}
|
||||
uri := ref.Manifest()
|
||||
user, pass := ref.Userinfo()
|
||||
uri := ref.Manifest(tag)
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodHead, uri, nil)
|
||||
if err != nil {
|
||||
@@ -27,15 +26,6 @@ func (cli *Client) ManifestExists(ctx context.Context, rawref string) (bool, str
|
||||
}
|
||||
req.Header.Set("User-Agent", cli.userAgent)
|
||||
req.Header.Set("Accept", "*/*")
|
||||
|
||||
if cli.authenticator != nil {
|
||||
authHeader, authKey, err := cli.authenticator.MakeHeader(user, pass)
|
||||
if err != nil {
|
||||
return exist, mime, size, csum, err
|
||||
}
|
||||
req.Header.Set(authHeader, authKey)
|
||||
}
|
||||
|
||||
resp, err := cli.httpClient.Do(req)
|
||||
if err != nil {
|
||||
return exist, mime, size, csum, err
|
||||
|
||||
Reference in New Issue
Block a user