Fix stat URL sent back on Stat()

This commit is contained in:
Harshavardhana
2015-05-20 19:40:30 -07:00
parent afe89bc44e
commit 1c899e5059
5 changed files with 76 additions and 5 deletions
-2
View File
@@ -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}}
}
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+73
View File
@@ -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)
}
+1 -1
View File
@@ -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)