mirror of
https://github.com/minio/minio.git
synced 2025-11-22 18:47:43 -05:00
XL/ListObjects: Fix ordering issue during listing if the files were uploaded as multipart uploads. (#1498) (#1506)
i.e if two files "tmp" and "tmp.1" are uploaded as multipart we would list ""tmp.1"" before ""tmp"" as "tmp.1/" < "tmp/"
This commit is contained in:
committed by
Harshavardhana
parent
5133ea50bd
commit
48d3be36da
@@ -21,6 +21,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -41,6 +42,16 @@ type MultipartObjectInfo struct {
|
||||
MD5Sum string
|
||||
}
|
||||
|
||||
type byMultipartFiles []string
|
||||
|
||||
func (files byMultipartFiles) Len() int { return len(files) }
|
||||
func (files byMultipartFiles) Less(i, j int) bool {
|
||||
first := strings.TrimSuffix(files[i], multipartSuffix)
|
||||
second := strings.TrimSuffix(files[j], multipartSuffix)
|
||||
return first < second
|
||||
}
|
||||
func (files byMultipartFiles) Swap(i, j int) { files[i], files[j] = files[j], files[i] }
|
||||
|
||||
// GetPartNumberOffset - given an offset for the whole object, return the part and offset in that part.
|
||||
func (m MultipartObjectInfo) GetPartNumberOffset(offset int64) (partIndex int, partOffset int64, err error) {
|
||||
partOffset = offset
|
||||
|
||||
Reference in New Issue
Block a user