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

@@ -101,9 +101,13 @@ func SeaweedList(client SeaweedFilerClient, parentDirectoryPath, prefix string,
func doSeaweedList(client SeaweedFilerClient, fullDirPath util.FullPath, prefix string, fn EachEntryFunciton, startFrom string, inclusive bool, limit uint32) (err error) {
// Redundancy limit to make it correctly judge whether it is the last file.
redLimit := limit
if limit != math.MaxInt32 && limit != 0 {
if limit < math.MaxInt32 && limit != 0 {
redLimit = limit + 1
}
if redLimit > math.MaxInt32 {
redLimit = math.MaxInt32
}
request := &ListEntriesRequest{
Directory: string(fullDirPath),
Prefix: prefix,