Use filepath.Clean() instead of path.Clean()

This commit is contained in:
Pengfei Ni 2018-04-17 10:44:30 +08:00
parent 28f9356ad1
commit dca0128966
3 changed files with 6 additions and 4 deletions

View File

@ -19,6 +19,7 @@ package downwardapi
import (
"fmt"
"path"
"path/filepath"
"sort"
"strings"
@ -229,7 +230,7 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
data := make(map[string]volumeutil.FileProjection)
for _, fileInfo := range items {
var fileProjection volumeutil.FileProjection
fPath := path.Clean(fileInfo.Path)
fPath := filepath.Clean(fileInfo.Path)
if fileInfo.Mode != nil {
fileProjection.Mode = *fileInfo.Mode
} else {

View File

@ -18,7 +18,8 @@ package quobyte
import (
"net"
"path"
"os"
"path/filepath"
"strings"
"k8s.io/api/core/v1"
@ -101,7 +102,7 @@ func (mounter *quobyteMounter) pluginDirIsMounted(pluginDir string) (bool, error
}
func (mounter *quobyteMounter) correctTraillingSlash(regStr string) string {
return path.Clean(regStr) + "/"
return filepath.Clean(regStr) + string(os.PathSeparator)
}
func validateRegistry(registry string) bool {

View File

@ -804,7 +804,7 @@ func checkVolumeContents(targetDir, tcName string, payload map[string]FileProjec
cleanPathPayload := make(map[string]FileProjection, len(payload))
for k, v := range payload {
cleanPathPayload[path.Clean(k)] = v
cleanPathPayload[filepath.Clean(k)] = v
}
if !reflect.DeepEqual(cleanPathPayload, observedPayload) {