working commit
This commit is contained in:
+2
-11
@@ -8,11 +8,11 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func (cli *Client) PatchUpload(ctx context.Context, rawref string, src io.Reader, uploc string, size int64) (string, error) {
|
||||
func (cli *Client) PatchUpload(ctx context.Context, rawrepo string, src io.Reader, uploc string, size int64) (string, error) {
|
||||
var err error
|
||||
var ouloc string
|
||||
|
||||
ref, err := NewReference(rawref)
|
||||
ref, err := NewRepository(rawrepo)
|
||||
if err != nil {
|
||||
return ouloc, err
|
||||
}
|
||||
@@ -20,8 +20,6 @@ func (cli *Client) PatchUpload(ctx context.Context, rawref string, src io.Reader
|
||||
if err != nil {
|
||||
return ouloc, err
|
||||
}
|
||||
user, pass := ref.Userinfo()
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPatch, uri, src)
|
||||
if err != nil {
|
||||
return ouloc, err
|
||||
@@ -29,13 +27,6 @@ func (cli *Client) PatchUpload(ctx context.Context, rawref string, src io.Reader
|
||||
req.Header.Set("User-Agent", cli.userAgent)
|
||||
req.Header.Set("Content-Type", "application/octet-stream")
|
||||
req.Header.Set("Content-Length", strconv.FormatInt(size, 10))
|
||||
if cli.authenticator != nil {
|
||||
authHeader, authKey, err := cli.authenticator.MakeHeader(user, pass)
|
||||
if err != nil {
|
||||
return ouloc, err
|
||||
}
|
||||
req.Header.Set(authHeader, authKey)
|
||||
}
|
||||
resp, err := cli.httpClient.Do(req)
|
||||
if err != nil {
|
||||
return ouloc, err
|
||||
|
||||
Reference in New Issue
Block a user