extend previous PRs behavior to WalkVersions as well

This commit is contained in:
Harshavardhana 2021-05-05 09:44:52 -07:00
parent ca0c9a2cfd
commit 6399e5e589
2 changed files with 7 additions and 1 deletions

View file

@ -54,6 +54,7 @@ type Entry struct {
Trigger string `json:"trigger,omitempty"`
}
// NewEntry initializes a new audit entry
func NewEntry(deploymentID string) Entry {
return Entry{
Version: Version,

View file

@ -977,6 +977,10 @@ func (s *xlStorage) WalkVersions(ctx context.Context, volume, dirPath, marker st
dirObjects := make(map[string]struct{})
for walkResult := range walkResultCh {
var fiv FileInfoVersions
if HasSuffix(walkResult.entry, SlashSeparator) && walkResult.emptyDir {
// Avoid listing empty directory, they are not supposed to exist
continue
}
if HasSuffix(walkResult.entry, SlashSeparator) && !walkResult.emptyDir {
_, dirObj := dirObjects[walkResult.entry]
if dirObj {
@ -1084,7 +1088,8 @@ func (s *xlStorage) Walk(ctx context.Context, volume, dirPath, marker string, re
if HasSuffix(walkResult.entry, SlashSeparator) && walkResult.emptyDir {
// Avoid listing empty directory, they are not supposed to exist
continue
} else if HasSuffix(walkResult.entry, SlashSeparator) && !walkResult.emptyDir {
}
if HasSuffix(walkResult.entry, SlashSeparator) && !walkResult.emptyDir {
_, dirObj := dirObjects[walkResult.entry]
if dirObj {
continue