Merge pull request #546 from harshavardhana/pr_out_recursive_copy_with_prefix_works_now_fixes_496

This commit is contained in:
Harshavardhana
2015-04-26 16:04:17 -07:00
3 changed files with 5 additions and 6 deletions
+3 -1
View File
@@ -58,7 +58,7 @@ EXAMPLES:
}
catCmd = cli.Command{
Name: "cat",
Usage: "Concantenate an object to standard output",
Usage: "Concantenate objects or files to standard output",
Action: runCatCmd,
CustomHelpTemplate: `NAME:
mc {{.Name}} - {{.Usage}}
@@ -80,6 +80,8 @@ EXAMPLES:
2. Concantenate a file from local filesystem to standard output.
$ mc {{.Name}} khitomer-accords.txt
3. Concantenate multiple files from local filesystem to standard output.
$ mc {{.Name}} *.txt > newfile.txt
`,
}
cpCmd = cli.Command{
+1
View File
@@ -59,6 +59,7 @@ func doCopySingleSourceRecursive(methods clientMethods, sourceURL, targetURL str
if itemCh.Err != nil {
continue
}
sourceURL = strings.TrimSuffix(sourceURL, getObjectKey(sourceURL))
newSourceURL := strings.TrimSuffix(sourceURL, pathSeparator) + pathSeparator + itemCh.Item.Name
newTargetURL := strings.TrimSuffix(targetURL, pathSeparator) + pathSeparator + itemCh.Item.Name
if err := doCopySingleSource(methods, newSourceURL, newTargetURL, sourceConfig, targetConfig); err != nil {
+1 -5
View File
@@ -24,8 +24,6 @@ import (
"io"
"net/http"
"net/url"
"path/filepath"
"strings"
"github.com/minio-io/mc/pkg/client"
"github.com/minio-io/minio/pkg/iodine"
@@ -126,9 +124,7 @@ func (c *s3Client) filterItems(startAt, marker, prefix, delimiter string, conten
return nil, marker, iodine.New(client.UnexpectedError{Err: errors.New(msg)}, nil)
}
item := new(client.Item)
// TODO (y4m4) - this is temporary, fix this after passing down proper delimiters
// for now using filepath.Separator
item.Name = strings.TrimPrefix(it.Key, filepath.Clean(prefix)+string(filepath.Separator))
item.Name = it.Key
item.Time = it.LastModified
item.Size = it.Size
item.FileType = 0