mirror of https://github.com/k3s-io/k3s
Merge pull request #62694 from feiskyer/clean-filepath
Automatic merge from submit-queue (batch tested with PRs 62694, 62569, 62646, 61633, 62433). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Use filepath.Clean() instead of path.Clean() **What this PR does / why we need it**: Use filepath.Clean() instead of path.Clean() across `pkg/volume`. This could fix potential issues for windows containers. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: followup of #62375. **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` /assign @msau42pull/8/head
commit
4d405a8348
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue