mirror of
https://github.com/offen/docker-volume-backup.git
synced 2026-04-23 00:45:36 +02:00
Address comments part 2
* OpenAPI Mock spec path adjusted * Dropbox FileMetadata reflection refactored * NaturalNumber type added
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -233,17 +232,18 @@ func (b *dropboxStorage) Prune(deadline time.Time, pruningPrefix string) (*stora
|
||||
var matches []*files.FileMetadata
|
||||
var lenCandidates int
|
||||
for _, candidate := range entries {
|
||||
if reflect.Indirect(reflect.ValueOf(candidate)).Type() != reflect.TypeOf(files.FileMetadata{}) {
|
||||
switch candidate := candidate.(type) {
|
||||
case *files.FileMetadata:
|
||||
if !strings.HasPrefix(candidate.Name, pruningPrefix) {
|
||||
continue
|
||||
}
|
||||
lenCandidates++
|
||||
if candidate.ServerModified.Before(deadline) {
|
||||
matches = append(matches, candidate)
|
||||
}
|
||||
default:
|
||||
continue
|
||||
}
|
||||
candidate := candidate.(*files.FileMetadata)
|
||||
if !strings.HasPrefix(candidate.Name, pruningPrefix) {
|
||||
continue
|
||||
}
|
||||
lenCandidates++
|
||||
if candidate.ServerModified.Before(deadline) {
|
||||
matches = append(matches, candidate)
|
||||
}
|
||||
}
|
||||
|
||||
stats := &storage.PruneStats{
|
||||
|
||||
Reference in New Issue
Block a user