diff --git a/cp-url.go b/cp-url.go index b805c29b..84f4ec7d 100644 --- a/cp-url.go +++ b/cp-url.go @@ -181,7 +181,6 @@ func prepareCopyURLsTypeA(sourceURL string, targetURL string) *cpURLs { // Source is not a regular file return &cpURLs{Error: iodine.New(errInvalidSource{path: sourceURL}, nil)} } - targetClient, err := target2Client(targetURL) if err != nil { return &cpURLs{Error: iodine.New(err, nil)} @@ -200,7 +199,6 @@ func prepareCopyURLsTypeA(sourceURL string, targetURL string) *cpURLs { return &cpURLs{Error: iodine.New(errSameURLs{source: sourceURL, target: targetURL}, nil)} } } - // All OK.. We can proceed. Type A return &cpURLs{SourceContent: sourceContent, TargetContent: &client.Content{Name: targetURL}} } diff --git a/diff_test.go b/diff_test.go index e6a101c5..86fb7685 100644 --- a/diff_test.go +++ b/diff_test.go @@ -1,5 +1,5 @@ /* - * Minio Client (C) 2014, 2015 Minio, Inc. + * Minio Client (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ls_test.go b/ls_test.go index 9213a3ba..e75e8172 100644 --- a/ls_test.go +++ b/ls_test.go @@ -1,5 +1,5 @@ /* - * Minio Client (C) 2014, 2015 Minio, Inc. + * Minio Client (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/mb_access_test.go b/mb_access_test.go new file mode 100644 index 00000000..40c364cc --- /dev/null +++ b/mb_access_test.go @@ -0,0 +1,73 @@ +/* + * Minio Client (C) 2015 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package main + +import ( + "io/ioutil" + "os" + "path/filepath" + "runtime" + + . "github.com/minio/check" +) + +func (s *CmdTestSuite) TestMbCmd(c *C) { + configDir, err := ioutil.TempDir(os.TempDir(), "cmd-") + c.Assert(err, IsNil) + defer os.RemoveAll(configDir) + switch runtime.GOOS { + case "windows": + mcConfigWindowsDir = configDir + default: + mcConfigDir = configDir + } + _, err = doConfig("generate", nil) + c.Assert(err, IsNil) + + /// filesystem + root, err := ioutil.TempDir(os.TempDir(), "cmd-") + c.Assert(err, IsNil) + defer os.RemoveAll(root) + + _, err = doMakeBucketCmd(filepath.Join(root, "bucket"), &hostConfig{}, false) + c.Assert(err, IsNil) +} + +func (s *CmdTestSuite) TestAccessCmd(c *C) { + configDir, err := ioutil.TempDir(os.TempDir(), "cmd-") + c.Assert(err, IsNil) + defer os.RemoveAll(configDir) + switch runtime.GOOS { + case "windows": + mcConfigWindowsDir = configDir + default: + mcConfigDir = configDir + } + _, err = doConfig("generate", nil) + c.Assert(err, IsNil) + + /// filesystem + root, err := ioutil.TempDir(os.TempDir(), "cmd-") + c.Assert(err, IsNil) + defer os.RemoveAll(root) + + _, err = doMakeBucketCmd(filepath.Join(root, "bucket"), &hostConfig{}, false) + c.Assert(err, IsNil) + + _, err = doUpdateAccessCmd(filepath.Join(root, "bucket"), "public-read-write", &hostConfig{}, false) + c.Assert(err, IsNil) +} diff --git a/pkg/client/s3/s3.go b/pkg/client/s3/s3.go index 2021ebb2..8e264659 100644 --- a/pkg/client/s3/s3.go +++ b/pkg/client/s3/s3.go @@ -152,7 +152,7 @@ func (c *s3Client) Stat() (*client.Content, error) { return nil, iodine.New(err, nil) } objectMetadata := new(client.Content) - objectMetadata.Name = metadata.Key + objectMetadata.Name = c.hostURL.String() // do not change this objectMetadata.Time = metadata.LastModified objectMetadata.Size = metadata.Size objectMetadata.Type = os.FileMode(0664)