Unverified Commit b684a282 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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: 's avatarallencloud <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 ```
parents 2966cdaa f63d8287
...@@ -257,7 +257,7 @@ func validatePath(targetPath string) error { ...@@ -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 { ...@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment