add accntcli
This commit is contained in:
@@ -38,6 +38,10 @@ func (cli *Client) ListFiles(ctx context.Context, rawpath string) ([]byte, error
|
||||
return list, err
|
||||
}
|
||||
contentLength := resp.Header.Get("Content-Length")
|
||||
if contentLength == "" {
|
||||
err := fmt.Errorf("Content-Length header is missing")
|
||||
return list, err
|
||||
}
|
||||
blobSize, err := strconv.ParseInt(contentLength, 10, 64)
|
||||
if err != nil {
|
||||
return list, err
|
||||
@@ -45,7 +49,7 @@ func (cli *Client) ListFiles(ctx context.Context, rawpath string) ([]byte, error
|
||||
buffer := bytes.NewBuffer(nil)
|
||||
recSize, err := Copy(ctx, buffer, resp.Body)
|
||||
if blobSize != recSize {
|
||||
err := fmt.Errorf("Mismatch declared and actual body size, %d and %d", blobSize, recSize)
|
||||
err := fmt.Errorf("Mismatch declared and actual body size: %d and %d", blobSize, recSize)
|
||||
return list, err
|
||||
}
|
||||
list = buffer.Bytes()
|
||||
|
||||
Reference in New Issue
Block a user