forked from TrueCloudLab/distribution
fix nil pointer in s3 list api
Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
This commit is contained in:
parent
252619876a
commit
8619a11f73
1 changed files with 12 additions and 12 deletions
|
@ -874,20 +874,20 @@ func (d *driver) List(ctx context.Context, opath string) ([]string, error) {
|
||||||
directories = append(directories, strings.Replace(commonPrefix[0:len(commonPrefix)-1], d.s3Path(""), prefix, 1))
|
directories = append(directories, strings.Replace(commonPrefix[0:len(commonPrefix)-1], d.s3Path(""), prefix, 1))
|
||||||
}
|
}
|
||||||
|
|
||||||
if *resp.IsTruncated {
|
if resp.IsTruncated == nil || !*resp.IsTruncated {
|
||||||
resp, err = d.S3.ListObjectsV2WithContext(ctx, &s3.ListObjectsV2Input{
|
|
||||||
Bucket: aws.String(d.Bucket),
|
|
||||||
Prefix: aws.String(d.s3Path(path)),
|
|
||||||
Delimiter: aws.String("/"),
|
|
||||||
MaxKeys: aws.Int64(listMax),
|
|
||||||
ContinuationToken: resp.NextContinuationToken,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resp, err = d.S3.ListObjectsV2WithContext(ctx, &s3.ListObjectsV2Input{
|
||||||
|
Bucket: aws.String(d.Bucket),
|
||||||
|
Prefix: aws.String(d.s3Path(path)),
|
||||||
|
Delimiter: aws.String("/"),
|
||||||
|
MaxKeys: aws.Int64(listMax),
|
||||||
|
ContinuationToken: resp.NextContinuationToken,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if opath != "/" {
|
if opath != "/" {
|
||||||
|
|
Loading…
Reference in a new issue