fix incorrect comparison in /pkg/volume error message

Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
allencloud 2017-08-16 10:44:53 +08:00
parent 036456a892
commit f63d828745

View File

@ -250,7 +250,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))
@ -259,7 +259,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 {