mirror of
https://github.com/distribution/distribution.git
synced 2025-09-01 23:17:33 +00:00
Merge pull request #3713 from Jamstah/s3-tests
This commit is contained in:
@@ -1041,18 +1041,8 @@ func (d *driver) URLFor(ctx context.Context, path string, options map[string]int
|
||||
// Walk traverses a filesystem defined within driver, starting
|
||||
// from the given path, calling f on each file
|
||||
func (d *driver) Walk(ctx context.Context, from string, f storagedriver.WalkFn) error {
|
||||
path := from
|
||||
if !strings.HasSuffix(path, "/") {
|
||||
path = path + "/"
|
||||
}
|
||||
|
||||
prefix := ""
|
||||
if d.s3Path("") == "" {
|
||||
prefix = "/"
|
||||
}
|
||||
|
||||
var objectCount int64
|
||||
if err := d.doWalk(ctx, &objectCount, d.s3Path(path), prefix, f); err != nil {
|
||||
if err := d.doWalk(ctx, &objectCount, from, f); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1064,7 +1054,7 @@ func (d *driver) Walk(ctx context.Context, from string, f storagedriver.WalkFn)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, path, prefix string, f storagedriver.WalkFn) error {
|
||||
func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, from string, f storagedriver.WalkFn) error {
|
||||
var (
|
||||
retError error
|
||||
// the most recent directory walked for de-duping
|
||||
@@ -1072,11 +1062,21 @@ func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, path, pre
|
||||
// the most recent skip directory to avoid walking over undesirable files
|
||||
prevSkipDir string
|
||||
)
|
||||
prevDir = strings.Replace(path, d.s3Path(""), prefix, 1)
|
||||
prevDir = from
|
||||
|
||||
path := from
|
||||
if !strings.HasSuffix(path, "/") {
|
||||
path = path + "/"
|
||||
}
|
||||
|
||||
prefix := ""
|
||||
if d.s3Path("") == "" {
|
||||
prefix = "/"
|
||||
}
|
||||
|
||||
listObjectsInput := &s3.ListObjectsV2Input{
|
||||
Bucket: aws.String(d.Bucket),
|
||||
Prefix: aws.String(path),
|
||||
Prefix: aws.String(d.s3Path(path)),
|
||||
MaxKeys: aws.Int64(listMax),
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user