mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #50724 from allencloud/fix-incorrect-comparison-log
Automatic merge from submit-queue. 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>. fix incorrect comparison in /pkg/volume error message Signed-off-by: allencloud <allen.sun@daocloud.io> **What this PR does / why we need it**: This PR fixes incorrect error message when there is comparison. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # NONE **Special notes for your reviewer**: NONE **Release note**: ```release-note NONE ```
This commit is contained in:
commit
b684a282e5
@ -257,7 +257,7 @@ func validatePath(targetPath string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(targetPath) > maxPathLength {
|
if len(targetPath) > maxPathLength {
|
||||||
return fmt.Errorf("invalid path: must be less than %d characters", maxPathLength)
|
return fmt.Errorf("invalid path: must be less than or equal to %d characters", maxPathLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
items := strings.Split(targetPath, string(os.PathSeparator))
|
items := strings.Split(targetPath, string(os.PathSeparator))
|
||||||
@ -266,7 +266,7 @@ func validatePath(targetPath string) error {
|
|||||||
return fmt.Errorf("invalid path: must not contain '..': %s", targetPath)
|
return fmt.Errorf("invalid path: must not contain '..': %s", targetPath)
|
||||||
}
|
}
|
||||||
if len(item) > maxFileNameLength {
|
if len(item) > maxFileNameLength {
|
||||||
return fmt.Errorf("invalid path: filenames must be less than %d characters", maxFileNameLength)
|
return fmt.Errorf("invalid path: filenames must be less than or equal to %d characters", maxFileNameLength)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(items[0], "..") && len(items[0]) > 2 {
|
if strings.HasPrefix(items[0], "..") && len(items[0]) > 2 {
|
||||||
|
Loading…
Reference in New Issue
Block a user