|
|
@ -127,7 +127,7 @@ func (web *webAPIHandlers) StorageInfo(r *http.Request, args *GenericArgs, reply |
|
|
|
reply.UIVersion = miniobrowser.UIVersion |
|
|
|
reply.UIVersion = miniobrowser.UIVersion |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
|
return &json2.Error{Message: "Server not initialized"} |
|
|
|
return &json2.Error{Message: "Server not initialized, please try again., please try again."} |
|
|
|
} |
|
|
|
} |
|
|
|
reply.StorageInfo = objectAPI.StorageInfo() |
|
|
|
reply.StorageInfo = objectAPI.StorageInfo() |
|
|
|
return nil |
|
|
|
return nil |
|
|
@ -146,7 +146,7 @@ func (web *webAPIHandlers) MakeBucket(r *http.Request, args *MakeBucketArgs, rep |
|
|
|
reply.UIVersion = miniobrowser.UIVersion |
|
|
|
reply.UIVersion = miniobrowser.UIVersion |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
|
return &json2.Error{Message: "Server not initialized"} |
|
|
|
return &json2.Error{Message: "Server not initialized, please try again."} |
|
|
|
} |
|
|
|
} |
|
|
|
if err := objectAPI.MakeBucket(args.BucketName); err != nil { |
|
|
|
if err := objectAPI.MakeBucket(args.BucketName); err != nil { |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
@ -175,7 +175,7 @@ func (web *webAPIHandlers) ListBuckets(r *http.Request, args *WebGenericArgs, re |
|
|
|
} |
|
|
|
} |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
|
return &json2.Error{Message: "Server not initialized"} |
|
|
|
return &json2.Error{Message: "Server not initialized, please try again."} |
|
|
|
} |
|
|
|
} |
|
|
|
buckets, err := objectAPI.ListBuckets() |
|
|
|
buckets, err := objectAPI.ListBuckets() |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -227,7 +227,7 @@ func (web *webAPIHandlers) ListObjects(r *http.Request, args *ListObjectsArgs, r |
|
|
|
for { |
|
|
|
for { |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
|
return &json2.Error{Message: "Server not initialized"} |
|
|
|
return &json2.Error{Message: "Server not initialized, please try again."} |
|
|
|
} |
|
|
|
} |
|
|
|
lo, err := objectAPI.ListObjects(args.BucketName, args.Prefix, marker, "/", 1000) |
|
|
|
lo, err := objectAPI.ListObjects(args.BucketName, args.Prefix, marker, "/", 1000) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -269,7 +269,7 @@ func (web *webAPIHandlers) RemoveObject(r *http.Request, args *RemoveObjectArgs, |
|
|
|
reply.UIVersion = miniobrowser.UIVersion |
|
|
|
reply.UIVersion = miniobrowser.UIVersion |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
|
return &json2.Error{Message: "Server not initialized"} |
|
|
|
return &json2.Error{Message: "Server not initialized, please try again."} |
|
|
|
} |
|
|
|
} |
|
|
|
if err := objectAPI.DeleteObject(args.BucketName, args.ObjectName); err != nil { |
|
|
|
if err := objectAPI.DeleteObject(args.BucketName, args.ObjectName); err != nil { |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
|
return &json2.Error{Message: err.Error()} |
|
|
@ -412,7 +412,7 @@ func (web *webAPIHandlers) Upload(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
|
|
|
|
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
|
writeWebErrorResponse(w, errors.New("Server not initialized")) |
|
|
|
writeWebErrorResponse(w, errors.New("Server not initialized, please try again.")) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if _, err := objectAPI.PutObject(bucket, object, -1, r.Body, metadata); err != nil { |
|
|
|
if _, err := objectAPI.PutObject(bucket, object, -1, r.Body, metadata); err != nil { |
|
|
@ -468,7 +468,7 @@ func (web *webAPIHandlers) Download(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
|
|
|
|
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
|
writeWebErrorResponse(w, errors.New("Server not initialized")) |
|
|
|
writeWebErrorResponse(w, errors.New("Server not initialized, please try again.")) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
objInfo, err := objectAPI.GetObjectInfo(bucket, object) |
|
|
|
objInfo, err := objectAPI.GetObjectInfo(bucket, object) |
|
|
@ -567,7 +567,7 @@ func (web *webAPIHandlers) GetBucketPolicy(r *http.Request, args *GetBucketPolic |
|
|
|
|
|
|
|
|
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
|
return &json2.Error{Message: "Server not initialized"} |
|
|
|
return &json2.Error{Message: "Server not initialized, please try again."} |
|
|
|
} |
|
|
|
} |
|
|
|
policyInfo, err := readBucketAccessPolicy(objectAPI, args.BucketName) |
|
|
|
policyInfo, err := readBucketAccessPolicy(objectAPI, args.BucketName) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -630,7 +630,7 @@ func (web *webAPIHandlers) SetBucketPolicy(r *http.Request, args *SetBucketPolic |
|
|
|
} |
|
|
|
} |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
objectAPI := web.ObjectAPI() |
|
|
|
if objectAPI == nil { |
|
|
|
if objectAPI == nil { |
|
|
|
return &json2.Error{Message: "Server not initialized"} |
|
|
|
return &json2.Error{Message: "Server not initialized, please try again."} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bucketP := policy.BucketPolicy(args.Policy) |
|
|
|
bucketP := policy.BucketPolicy(args.Policy) |
|
|
|