mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-01-18 06:30:07 +08:00
Merge pull request #1077 from iliul/fix-commonprefix-issue
s3 api: fix listbucket common_prefixes issue
This commit is contained in:
commit
8599442ab1
@ -91,6 +91,11 @@ func (s3a *S3ApiServer) completeMultipartUpload(ctx context.Context, input *s3.C
|
|||||||
}
|
}
|
||||||
dirName = fmt.Sprintf("%s/%s/%s", s3a.option.BucketsPath, *input.Bucket, dirName)
|
dirName = fmt.Sprintf("%s/%s/%s", s3a.option.BucketsPath, *input.Bucket, dirName)
|
||||||
|
|
||||||
|
// remove suffix '/'
|
||||||
|
if strings.HasSuffix(dirName, "/") {
|
||||||
|
dirName = dirName[:len(dirName)-1]
|
||||||
|
}
|
||||||
|
|
||||||
err = s3a.mkFile(ctx, dirName, entryName, finalParts)
|
err = s3a.mkFile(ctx, dirName, entryName, finalParts)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -125,9 +125,11 @@ func (s3a *S3ApiServer) listFilerEntries(ctx context.Context, bucket, originalPr
|
|||||||
}
|
}
|
||||||
lastEntryName = entry.Name
|
lastEntryName = entry.Name
|
||||||
if entry.IsDirectory {
|
if entry.IsDirectory {
|
||||||
commonPrefixes = append(commonPrefixes, PrefixEntry{
|
if entry.Name != ".uploads" {
|
||||||
Prefix: fmt.Sprintf("%s%s/", dir, entry.Name),
|
commonPrefixes = append(commonPrefixes, PrefixEntry{
|
||||||
})
|
Prefix: fmt.Sprintf("%s%s/", dir, entry.Name),
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
contents = append(contents, ListEntry{
|
contents = append(contents, ListEntry{
|
||||||
Key: fmt.Sprintf("%s%s", dir, entry.Name),
|
Key: fmt.Sprintf("%s%s", dir, entry.Name),
|
||||||
|
@ -675,7 +675,7 @@ type PostResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PrefixEntry struct {
|
type PrefixEntry struct {
|
||||||
Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"`
|
Prefix string `xml:"Prefix"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PutObject struct {
|
type PutObject struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user