Skip to content

Commit

Permalink
fix: Fixes #182, fixed max-keys 0 case to not return any object key
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaustin09 committed Aug 3, 2023
1 parent dde13dd commit 67fc857
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions backend/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,21 @@ func Walk(fileSystem fs.FS, prefix, delimiter, marker string, max int32, getObj
pastMarker = true
}

var pastMax bool
pastMax := max == 0
var newMarker string
var truncated bool

err := fs.WalkDir(fileSystem, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
// Ignore the root directory
if path == "." {
return nil
}
if contains(d.Name(), skipdirs) {
return fs.SkipDir
}

if pastMax {
newMarker = path
Expand All @@ -63,15 +70,6 @@ func Walk(fileSystem fs.FS, prefix, delimiter, marker string, max int32, getObj
}

if d.IsDir() {
// Ignore the root directory
if path == "." {
return nil
}

if contains(d.Name(), skipdirs) {
return fs.SkipDir
}

// If prefix is defined and the directory does not match prefix,
// do not descend into the directory because nothing will
// match this prefix. Make sure to append the / at the end of
Expand Down

0 comments on commit 67fc857

Please sign in to comment.