mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fix object tagging https://github.com/chrislusf/seaweedfs/issues/2389
This commit is contained in:
parent
182f43ae5f
commit
c78220a7f2
|
@ -90,7 +90,7 @@ func (s3a *S3ApiServer) PutObjectTaggingHandler(w http.ResponseWriter, r *http.R
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusOK)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ var errorCodeResponse = map[ErrorCode]APIError{
|
||||||
HTTPStatusCode: http.StatusBadRequest,
|
HTTPStatusCode: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
ErrInvalidTag: {
|
ErrInvalidTag: {
|
||||||
Code: "InvalidArgument",
|
Code: "InvalidTag",
|
||||||
Description: "The Tag value you have provided is invalid",
|
Description: "The Tag value you have provided is invalid",
|
||||||
HTTPStatusCode: http.StatusBadRequest,
|
HTTPStatusCode: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
|
|
|
@ -113,17 +113,15 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
|
||||||
w.Header().Set("Access-Control-Expose-Headers", strings.Join(seaweedHeaders, ","))
|
w.Header().Set("Access-Control-Expose-Headers", strings.Join(seaweedHeaders, ","))
|
||||||
|
|
||||||
//set tag count
|
//set tag count
|
||||||
if r.Method == "GET" {
|
tagCount := 0
|
||||||
tagCount := 0
|
for k := range entry.Extended {
|
||||||
for k := range entry.Extended {
|
if strings.HasPrefix(k, xhttp.AmzObjectTagging+"-") {
|
||||||
if strings.HasPrefix(k, xhttp.AmzObjectTagging+"-") {
|
tagCount++
|
||||||
tagCount++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if tagCount > 0 {
|
|
||||||
w.Header().Set(xhttp.AmzTagCount, strconv.Itoa(tagCount))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if tagCount > 0 {
|
||||||
|
w.Header().Set(xhttp.AmzTagCount, strconv.Itoa(tagCount))
|
||||||
|
}
|
||||||
|
|
||||||
if inm := r.Header.Get("If-None-Match"); inm == "\""+etag+"\"" {
|
if inm := r.Header.Get("If-None-Match"); inm == "\""+etag+"\"" {
|
||||||
w.WriteHeader(http.StatusNotModified)
|
w.WriteHeader(http.StatusNotModified)
|
||||||
|
|
|
@ -327,6 +327,8 @@ func SaveAmzMetaData(r *http.Request, existing map[string][]byte, isReplace bool
|
||||||
tag := strings.Split(v, "=")
|
tag := strings.Split(v, "=")
|
||||||
if len(tag) == 2 {
|
if len(tag) == 2 {
|
||||||
metadata[xhttp.AmzObjectTagging+"-"+tag[0]] = []byte(tag[1])
|
metadata[xhttp.AmzObjectTagging+"-"+tag[0]] = []byte(tag[1])
|
||||||
|
} else if len(tag) == 1 {
|
||||||
|
metadata[xhttp.AmzObjectTagging+"-"+tag[0]] = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue