avoid int bigger than math.MaxInt32

fix https://github.com/chrislusf/seaweedfs/issues/2363
This commit is contained in:
Chris Lu
2021-10-07 21:12:57 -07:00
parent d688e10ed1
commit 0a856241fe
4 changed files with 18 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ package filer
import (
"context"
"github.com/chrislusf/seaweedfs/weed/util"
"math"
"strings"
)
@@ -120,6 +121,10 @@ func (t *FilerStorePathTranlator) ListDirectoryPrefixedEntries(ctx context.Conte
newFullPath := t.translatePath(dirPath)
if limit > math.MaxInt32-1 {
limit = math.MaxInt32 - 1
}
return t.actualStore.ListDirectoryPrefixedEntries(ctx, newFullPath, startFileName, includeStartFile, limit, prefix, func(entry *Entry) bool {
entry.FullPath = dirPath[:len(t.storeRoot)-1] + entry.FullPath
return eachEntryFunc(entry)