s3api: fix ListObjectVersions inconsistency with delimiters (#8210)
* s3api: fix ListObjectVersions inconsistency with delimiters (fixes #8206) Prioritize handling of .versions and .uploads directories before delimiter processing in collectVersions. This ensures .versions directories are processed as version containers instead of being incorrectly rolled up into CommonPrefixes when a delimiter is used. * s3api: refactor processDirectory to remove redundant special directory checks These checks are now handled in the main collectVersions loop.
This commit is contained in:
@@ -640,6 +640,24 @@ func (vc *versionCollector) collectVersions(currentPath, relativePath string) er
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle special directories that should bypass delimiter logic
|
||||||
|
// This ensures .versions directories are processed as version containers
|
||||||
|
// rather than being rolled up into CommonPrefixes when a delimiter is used
|
||||||
|
if entry.IsDirectory {
|
||||||
|
// Skip .uploads directory
|
||||||
|
if strings.HasPrefix(entry.Name, s3_constants.MultipartUploadsFolder) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle .versions directory
|
||||||
|
if strings.HasSuffix(entry.Name, s3_constants.VersionsFolder) {
|
||||||
|
if err := vc.processVersionsDirectory(entryPath); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Group into common prefixes if delimiter is found after the prefix
|
// Group into common prefixes if delimiter is found after the prefix
|
||||||
if vc.delimiter != "" {
|
if vc.delimiter != "" {
|
||||||
fullKey := entryPath
|
fullKey := entryPath
|
||||||
@@ -688,16 +706,6 @@ func (vc *versionCollector) collectVersions(currentPath, relativePath string) er
|
|||||||
|
|
||||||
// processDirectory handles directory entries
|
// processDirectory handles directory entries
|
||||||
func (vc *versionCollector) processDirectory(currentPath, entryPath string, entry *filer_pb.Entry) error {
|
func (vc *versionCollector) processDirectory(currentPath, entryPath string, entry *filer_pb.Entry) error {
|
||||||
// Skip .uploads directory
|
|
||||||
if strings.HasPrefix(entry.Name, ".uploads") {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle .versions directory
|
|
||||||
if strings.HasSuffix(entry.Name, s3_constants.VersionsFolder) {
|
|
||||||
return vc.processVersionsDirectory(entryPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle explicit S3 directory object
|
// Handle explicit S3 directory object
|
||||||
if entry.Attributes.Mime == s3_constants.FolderMimeType {
|
if entry.Attributes.Mime == s3_constants.FolderMimeType {
|
||||||
vc.processExplicitDirectory(entryPath, entry)
|
vc.processExplicitDirectory(entryPath, entry)
|
||||||
|
|||||||
Reference in New Issue
Block a user