|
|
@ -176,6 +176,8 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa |
|
|
|
Size: chunkOffset, |
|
|
|
} |
|
|
|
|
|
|
|
fs.saveAmzMetaData(r, entry) |
|
|
|
|
|
|
|
if dbErr := fs.filer.CreateEntry(ctx, entry, false, false, nil); dbErr != nil { |
|
|
|
fs.filer.DeleteChunks(entry.Chunks) |
|
|
|
replyerr = dbErr |
|
|
@ -308,3 +310,36 @@ func (fs *FilerServer) mkdir(ctx context.Context, w http.ResponseWriter, r *http |
|
|
|
} |
|
|
|
return filerResult, replyerr |
|
|
|
} |
|
|
|
|
|
|
|
func (fs *FilerServer) saveAmzMetaData(r *http.Request, entry *filer.Entry) { |
|
|
|
var ( |
|
|
|
storageClass = "X-Amz-Storage-Class" |
|
|
|
objectTagging = "X-Amz-Tagging" |
|
|
|
userMetaPrefix = "X-Amz-Meta-" |
|
|
|
) |
|
|
|
|
|
|
|
if entry.Extended == nil { |
|
|
|
entry.Extended = make(map[string][]byte) |
|
|
|
} |
|
|
|
|
|
|
|
if sc := r.Header.Get(storageClass); sc != "" { |
|
|
|
entry.Extended[storageClass] = []byte(sc) |
|
|
|
} |
|
|
|
|
|
|
|
if tags := r.Header.Get(objectTagging); tags != "" { |
|
|
|
for _, v := range strings.Split(tags, "&") { |
|
|
|
tag := strings.Split(v, "=") |
|
|
|
if len(tag) == 2 { |
|
|
|
entry.Extended[objectTagging+"-"+tag[0]] = []byte(tag[1]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for header, values := range r.Header { |
|
|
|
if strings.HasPrefix(header, userMetaPrefix) { |
|
|
|
for _, value := range values { |
|
|
|
entry.Extended[header] = []byte(value) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |