mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Use filepath.Clean() instead of path.Clean()
This commit is contained in:
parent
28f9356ad1
commit
dca0128966
@ -19,6 +19,7 @@ package downwardapi
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -229,7 +230,7 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
|
|||||||
data := make(map[string]volumeutil.FileProjection)
|
data := make(map[string]volumeutil.FileProjection)
|
||||||
for _, fileInfo := range items {
|
for _, fileInfo := range items {
|
||||||
var fileProjection volumeutil.FileProjection
|
var fileProjection volumeutil.FileProjection
|
||||||
fPath := path.Clean(fileInfo.Path)
|
fPath := filepath.Clean(fileInfo.Path)
|
||||||
if fileInfo.Mode != nil {
|
if fileInfo.Mode != nil {
|
||||||
fileProjection.Mode = *fileInfo.Mode
|
fileProjection.Mode = *fileInfo.Mode
|
||||||
} else {
|
} else {
|
||||||
|
@ -18,7 +18,8 @@ package quobyte
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"path"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
@ -101,7 +102,7 @@ func (mounter *quobyteMounter) pluginDirIsMounted(pluginDir string) (bool, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mounter *quobyteMounter) correctTraillingSlash(regStr string) string {
|
func (mounter *quobyteMounter) correctTraillingSlash(regStr string) string {
|
||||||
return path.Clean(regStr) + "/"
|
return filepath.Clean(regStr) + string(os.PathSeparator)
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateRegistry(registry string) bool {
|
func validateRegistry(registry string) bool {
|
||||||
|
@ -804,7 +804,7 @@ func checkVolumeContents(targetDir, tcName string, payload map[string]FileProjec
|
|||||||
|
|
||||||
cleanPathPayload := make(map[string]FileProjection, len(payload))
|
cleanPathPayload := make(map[string]FileProjection, len(payload))
|
||||||
for k, v := range payload {
|
for k, v := range payload {
|
||||||
cleanPathPayload[path.Clean(k)] = v
|
cleanPathPayload[filepath.Clean(k)] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reflect.DeepEqual(cleanPathPayload, observedPayload) {
|
if !reflect.DeepEqual(cleanPathPayload, observedPayload) {
|
||||||
|
Loading…
Reference in New Issue
Block a user