browser: Object upload should save metadata and notify. (#2309)

Object upload from browser should save additional
incoming metadata. Additionally should also notify
through bucket notifications once they are set.

Fixes #2292
This commit is contained in:
Harshavardhana
2016-07-27 21:11:15 -07:00
committed by Anand Babu (AB) Periasamy
parent ad19bf0ec1
commit 65f71ce0c5
4 changed files with 36 additions and 10 deletions

View File

@@ -32,10 +32,10 @@ const (
)
// loads notifcation config if any for a given bucket, returns back structured notification config.
func (api objectAPIHandlers) loadNotificationConfig(bucket string) (nConfig notificationConfig, err error) {
func loadNotificationConfig(objAPI ObjectLayer, bucket string) (nConfig notificationConfig, err error) {
notificationConfigPath := path.Join(bucketConfigPrefix, bucket, bucketNotificationConfig)
var objInfo ObjectInfo
objInfo, err = api.ObjectAPI.GetObjectInfo(minioMetaBucket, notificationConfigPath)
objInfo, err = objAPI.GetObjectInfo(minioMetaBucket, notificationConfigPath)
if err != nil {
switch err.(type) {
case ObjectNotFound:
@@ -44,7 +44,7 @@ func (api objectAPIHandlers) loadNotificationConfig(bucket string) (nConfig noti
return notificationConfig{}, err
}
var buffer bytes.Buffer
err = api.ObjectAPI.GetObject(minioMetaBucket, notificationConfigPath, 0, objInfo.Size, &buffer)
err = objAPI.GetObject(minioMetaBucket, notificationConfigPath, 0, objInfo.Size, &buffer)
if err != nil {
switch err.(type) {
case ObjectNotFound: