diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2021-10-20 10:59:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-20 10:59:22 -0700 |
| commit | 07dd4873db996c4f4a94ee3b0975052d0ec7595b (patch) | |
| tree | af291d9afde8e3be8ba9061e14edad75a34d0c6b /weed/s3api | |
| parent | 182f43ae5fa2aed5a2526aaa23390e9b8d376e63 (diff) | |
| parent | 235329a92a535650bc7f0556510ad6014eb15a70 (diff) | |
| download | seaweedfs-07dd4873db996c4f4a94ee3b0975052d0ec7595b.tar.xz seaweedfs-07dd4873db996c4f4a94ee3b0975052d0ec7595b.zip | |
Merge pull request #2390 from kmlebedev/fix_tagging
Diffstat (limited to 'weed/s3api')
| -rw-r--r-- | weed/s3api/s3api_object_tagging_handlers.go | 2 | ||||
| -rw-r--r-- | weed/s3api/s3err/s3api_errors.go | 2 | ||||
| -rw-r--r-- | weed/s3api/tags.go | 5 | ||||
| -rw-r--r-- | weed/s3api/tags_test.go | 1 |
4 files changed, 6 insertions, 4 deletions
diff --git a/weed/s3api/s3api_object_tagging_handlers.go b/weed/s3api/s3api_object_tagging_handlers.go index 4daee5485..1ba1fb52d 100644 --- a/weed/s3api/s3api_object_tagging_handlers.go +++ b/weed/s3api/s3api_object_tagging_handlers.go @@ -90,7 +90,7 @@ func (s3a *S3ApiServer) PutObjectTaggingHandler(w http.ResponseWriter, r *http.R return } - w.WriteHeader(http.StatusNoContent) + w.WriteHeader(http.StatusOK) } diff --git a/weed/s3api/s3err/s3api_errors.go b/weed/s3api/s3err/s3api_errors.go index 30b7c03b3..3063df844 100644 --- a/weed/s3api/s3err/s3api_errors.go +++ b/weed/s3api/s3err/s3api_errors.go @@ -202,7 +202,7 @@ var errorCodeResponse = map[ErrorCode]APIError{ HTTPStatusCode: http.StatusBadRequest, }, ErrInvalidTag: { - Code: "InvalidArgument", + Code: "InvalidTag", Description: "The Tag value you have provided is invalid", HTTPStatusCode: http.StatusBadRequest, }, diff --git a/weed/s3api/tags.go b/weed/s3api/tags.go index 9ff7d1fba..979e5a80c 100644 --- a/weed/s3api/tags.go +++ b/weed/s3api/tags.go @@ -14,8 +14,9 @@ type TagSet struct { } type Tagging struct { - XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Tagging"` + XMLName xml.Name `xml:"Tagging"` TagSet TagSet `xml:"TagSet"` + Xmlns string `xml:"xmlns,attr"` } func (t *Tagging) ToTags() map[string]string { @@ -27,7 +28,7 @@ func (t *Tagging) ToTags() map[string]string { } func FromTags(tags map[string]string) (t *Tagging) { - t = &Tagging{} + t = &Tagging{Xmlns: "http://s3.amazonaws.com/doc/2006-03-01/"} for k, v := range tags { t.TagSet.Tag = append(t.TagSet.Tag, Tag{ Key: k, diff --git a/weed/s3api/tags_test.go b/weed/s3api/tags_test.go index 52adb36c1..d8beb1922 100644 --- a/weed/s3api/tags_test.go +++ b/weed/s3api/tags_test.go @@ -32,6 +32,7 @@ func TestXMLUnmarshall(t *testing.T) { func TestXMLMarshall(t *testing.T) { tags := &Tagging{ + Xmlns: "http://s3.amazonaws.com/doc/2006-03-01/", TagSet: TagSet{ []Tag{ { |
