From ebe1e39e7dd6e02bb9d4ee8926acbe0611748c5c Mon Sep 17 00:00:00 2001 From: "changlin.shi" Date: Wed, 26 Oct 2022 16:02:25 +0800 Subject: [PATCH] fix parent path Signed-off-by: changlin.shi --- weed/s3api/s3api_acp.go | 6 ++++-- weed/s3api/s3api_object_handlers.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/weed/s3api/s3api_acp.go b/weed/s3api/s3api_acp.go index bafe19e88..00abc9155 100644 --- a/weed/s3api/s3api_acp.go +++ b/weed/s3api/s3api_acp.go @@ -9,6 +9,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/s3api/s3err" "github.com/seaweedfs/seaweedfs/weed/util" "net/http" + "path/filepath" ) func getAccountId(r *http.Request) string { @@ -102,6 +103,7 @@ func getObjectEntry(s3a *S3ApiServer, bucket, object string) (*filer_pb.Entry, e return s3a.getEntry(util.Join(s3a.option.BucketsPath, bucket), object) } -func updateObjectEntry(s3a *S3ApiServer, bucket string, entry *filer_pb.Entry) error { - return s3a.updateEntry(util.Join(s3a.option.BucketsPath, bucket), entry) +func updateObjectEntry(s3a *S3ApiServer, bucket, object string, entry *filer_pb.Entry) error { + dir, _ := filepath.Split(object) + return s3a.updateEntry(util.Join(s3a.option.BucketsPath, bucket, dir), entry) } diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index 8ee11c195..59a4a9b91 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -550,7 +550,7 @@ func (s3a *S3ApiServer) PutObjectAclHandler(w http.ResponseWriter, r *http.Reque return } - err := updateObjectEntry(s3a, bucket, objectEntry) + err := updateObjectEntry(s3a, bucket, object, objectEntry) if err != nil { s3err.WriteErrorResponse(w, r, s3err.ErrInternalError) return