Address comments part 2

* OpenAPI Mock spec path adjusted
* Dropbox FileMetadata reflection refactored
* NaturalNumber type added
This commit is contained in:
MaxJa4
2023-08-23 19:25:52 +02:00
parent c304b4f52b
commit 5147753a79
5 changed files with 34 additions and 38 deletions

View File

@@ -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{