diff options
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/s3api/filer_multipart.go | 5 | ||||
| -rw-r--r-- | weed/s3api/s3api_objects_list_handlers.go | 8 | ||||
| -rw-r--r-- | weed/s3api/s3api_xsd_generated.go | 2 | ||||
| -rw-r--r-- | weed/server/filer_server_handlers_write.go | 2 | ||||
| -rw-r--r-- | weed/server/master_server_handlers.go | 4 | ||||
| -rw-r--r-- | weed/shell/command_volume_list.go | 4 |
6 files changed, 16 insertions, 9 deletions
diff --git a/weed/s3api/filer_multipart.go b/weed/s3api/filer_multipart.go index c8fe05645..3bf4aafac 100644 --- a/weed/s3api/filer_multipart.go +++ b/weed/s3api/filer_multipart.go @@ -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) + // remove suffix '/' + if strings.HasSuffix(dirName, "/") { + dirName = dirName[:len(dirName)-1] + } + err = s3a.mkFile(ctx, dirName, entryName, finalParts) if err != nil { diff --git a/weed/s3api/s3api_objects_list_handlers.go b/weed/s3api/s3api_objects_list_handlers.go index 4053913fb..1fc8b6b37 100644 --- a/weed/s3api/s3api_objects_list_handlers.go +++ b/weed/s3api/s3api_objects_list_handlers.go @@ -125,9 +125,11 @@ func (s3a *S3ApiServer) listFilerEntries(ctx context.Context, bucket, originalPr } lastEntryName = entry.Name if entry.IsDirectory { - commonPrefixes = append(commonPrefixes, PrefixEntry{ - Prefix: fmt.Sprintf("%s%s/", dir, entry.Name), - }) + if entry.Name != ".uploads" { + commonPrefixes = append(commonPrefixes, PrefixEntry{ + Prefix: fmt.Sprintf("%s%s/", dir, entry.Name), + }) + } } else { contents = append(contents, ListEntry{ Key: fmt.Sprintf("%s%s", dir, entry.Name), diff --git a/weed/s3api/s3api_xsd_generated.go b/weed/s3api/s3api_xsd_generated.go index 573c09ede..9d62afc4e 100644 --- a/weed/s3api/s3api_xsd_generated.go +++ b/weed/s3api/s3api_xsd_generated.go @@ -675,7 +675,7 @@ type PostResponse struct { } type PrefixEntry struct { - Prefix string `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Prefix"` + Prefix string `xml:"Prefix"` } type PutObject struct { diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go index b419c51af..5d95a5d7e 100644 --- a/weed/server/filer_server_handlers_write.go +++ b/weed/server/filer_server_handlers_write.go @@ -275,7 +275,7 @@ func (fs *FilerServer) DeleteHandler(w http.ResponseWriter, r *http.Request) { isRecursive := r.FormValue("recursive") == "true" ignoreRecursiveError := r.FormValue("ignoreRecursiveError") == "true" - err := fs.filer.DeleteEntryMetaAndData(context.Background(), filer2.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError,true) + err := fs.filer.DeleteEntryMetaAndData(context.Background(), filer2.FullPath(r.URL.Path), isRecursive, ignoreRecursiveError, true) if err != nil { glog.V(1).Infoln("deleting", r.URL.Path, ":", err.Error()) writeJsonError(w, r, http.StatusInternalServerError, err) diff --git a/weed/server/master_server_handlers.go b/weed/server/master_server_handlers.go index 93f983375..728c32076 100644 --- a/weed/server/master_server_handlers.go +++ b/weed/server/master_server_handlers.go @@ -48,7 +48,7 @@ func (ms *MasterServer) dirLookupHandler(w http.ResponseWriter, r *http.Request) collection := r.FormValue("collection") //optional, but can be faster if too many collections location := ms.findVolumeLocation(collection, vid) httpStatus := http.StatusOK - if location.Error != "" { + if location.Error != "" || location.Locations == nil { httpStatus = http.StatusNotFound } else { forRead := r.FormValue("read") @@ -60,7 +60,7 @@ func (ms *MasterServer) dirLookupHandler(w http.ResponseWriter, r *http.Request) // findVolumeLocation finds the volume location from master topo if it is leader, // or from master client if not leader -func (ms *MasterServer) findVolumeLocation(collection string, vid string) operation.LookupResult { +func (ms *MasterServer) findVolumeLocation(collection, vid string) operation.LookupResult { var locations []operation.Location var err error if ms.Topo.IsLeader() { diff --git a/weed/shell/command_volume_list.go b/weed/shell/command_volume_list.go index 134580ffe..91b5a0d32 100644 --- a/weed/shell/command_volume_list.go +++ b/weed/shell/command_volume_list.go @@ -98,7 +98,7 @@ func writeDataNodeInfo(writer io.Writer, t *master_pb.DataNodeInfo) statistics { } func writeVolumeInformationMessage(writer io.Writer, t *master_pb.VolumeInformationMessage) statistics { fmt.Fprintf(writer, " volume %+v \n", t) - return newStatiscis(t) + return newStatistics(t) } type statistics struct { @@ -108,7 +108,7 @@ type statistics struct { DeletedBytes uint64 } -func newStatiscis(t *master_pb.VolumeInformationMessage) statistics { +func newStatistics(t *master_pb.VolumeInformationMessage) statistics { return statistics{ Size: t.Size, FileCount: t.FileCount, |
