Windows support for copying local files to object storage (#3666)

This commit is contained in:
ebozduman
2021-09-22 14:38:56 -07:00
committed by GitHub
parent 4e4c912b37
commit 5a8f677304
+5 -1
View File
@@ -786,6 +786,10 @@ func (f *fsClient) listRecursiveInRoutine(contentCh chan *ClientContent, isMetad
var dirName string
var filePrefix string
pathURL := *f.PathURL
if runtime.GOOS == "windows" {
pathURL.Path = filepath.FromSlash(pathURL.Path)
pathURL.Separator = os.PathSeparator
}
visitFS := func(fp string, fi os.FileInfo, e error) error {
// If file path ends with filepath.Separator and equals to root path, skip it.
if strings.HasSuffix(fp, string(pathURL.Separator)) {
@@ -869,7 +873,7 @@ func (f *fsClient) listRecursiveInRoutine(contentCh chan *ClientContent, isMetad
dirName = filepath.Dir(pathURL.Path)
if !strings.HasSuffix(dirName, string(pathURL.Separator)) {
// basepath truncates the filepath.Separator,
// add it deligently useful for trimming file path inside WalkFunc
// add it diligently useful for trimming file path inside WalkFunc
dirName = dirName + string(pathURL.Separator)
}
// filePrefix is kept for filtering incoming contents through WalkFunc.