mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 06:46:34 +00:00
Azure: Fix List(), use pagination marker
This commit is contained in:
parent
f61dab1774
commit
dd49e2b12d
@ -264,14 +264,22 @@ func (be *Backend) List(ctx context.Context, t restic.FileType) <-chan string {
|
||||
prefix += "/"
|
||||
}
|
||||
|
||||
params := storage.ListBlobsParameters{
|
||||
MaxResults: 1000,
|
||||
Prefix: prefix,
|
||||
}
|
||||
|
||||
go func() {
|
||||
defer close(ch)
|
||||
|
||||
obj, err := be.container.ListBlobs(storage.ListBlobsParameters{Prefix: prefix})
|
||||
for {
|
||||
obj, err := be.container.ListBlobs(params)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
debug.Log("got %v objects", len(obj.Blobs))
|
||||
|
||||
for _, item := range obj.Blobs {
|
||||
m := strings.TrimPrefix(item.Name, prefix)
|
||||
if m == "" {
|
||||
@ -284,6 +292,12 @@ func (be *Backend) List(ctx context.Context, t restic.FileType) <-chan string {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if obj.NextMarker == "" {
|
||||
break
|
||||
}
|
||||
params.Marker = obj.NextMarker
|
||||
}
|
||||
}()
|
||||
|
||||
return ch
|
||||
|
Loading…
Reference in New Issue
Block a user