mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
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 @msau42
This commit is contained in:
commit
4d405a8348
@ -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