adjust s3 header file.

This commit is contained in:
ruitao.liu
2020-10-29 16:05:40 +08:00
parent b917be7955
commit 22a9ea0512
6 changed files with 44 additions and 154 deletions

View File

@@ -18,6 +18,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/operation"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
xhttp "github.com/chrislusf/seaweedfs/weed/s3api/http"
"github.com/chrislusf/seaweedfs/weed/security"
"github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/util"
@@ -317,21 +318,21 @@ func (fs *FilerServer) saveAmzMetaData(r *http.Request, entry *filer.Entry) {
entry.Extended = make(map[string][]byte)
}
if sc := r.Header.Get(util.AmzStorageClass); sc != "" {
entry.Extended[util.AmzStorageClass] = []byte(sc)
if sc := r.Header.Get(xhttp.AmzStorageClass); sc != "" {
entry.Extended[xhttp.AmzStorageClass] = []byte(sc)
}
if tags := r.Header.Get(util.AmzObjectTagging); tags != "" {
if tags := r.Header.Get(xhttp.AmzObjectTagging); tags != "" {
for _, v := range strings.Split(tags, "&") {
tag := strings.Split(v, "=")
if len(tag) == 2 {
entry.Extended[util.AmzObjectTagging+"-"+tag[0]] = []byte(tag[1])
entry.Extended[xhttp.AmzObjectTagging+"-"+tag[0]] = []byte(tag[1])
}
}
}
for header, values := range r.Header {
if strings.HasPrefix(header, util.AmzUserMetaPrefix) {
if strings.HasPrefix(header, xhttp.AmzUserMetaPrefix) {
for _, value := range values {
entry.Extended[header] = []byte(value)
}