From 0e3745c3843308e09d39de518e28a825ee385e40 Mon Sep 17 00:00:00 2001 From: Doflatango Date: Wed, 18 Jul 2018 14:57:28 +0800 Subject: [PATCH] Baned backslash in group name --- client.go | 2 +- errors.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index f94d0dc..d1fb1cd 100644 --- a/client.go +++ b/client.go @@ -120,7 +120,7 @@ func (c *Client) DelLock(key string) error { } func IsValidAsKeyPath(s string) bool { - return strings.IndexByte(s, '/') == -1 + return strings.IndexAny(s, "/\\") == -1 } // etcdTimeoutContext return better error info diff --git a/errors.go b/errors.go index 4d7285a..5815751 100644 --- a/errors.go +++ b/errors.go @@ -8,8 +8,8 @@ var ( ErrEmptyJobName = errors.New("Name of job is empty.") ErrEmptyJobCommand = errors.New("Command of job is empty.") - ErrIllegalJobId = errors.New("Invalid id that includes illegal characters such as '/'.") - ErrIllegalJobGroupName = errors.New("Invalid job group name that includes illegal characters such as '/'.") + ErrIllegalJobId = errors.New("Invalid id that includes illegal characters such as '/' '\\'.") + ErrIllegalJobGroupName = errors.New("Invalid job group name that includes illegal characters such as '/' '\\'.") ErrEmptyNodeGroupName = errors.New("Name of node group is empty.") ErrIllegalNodeGroupId = errors.New("Invalid node group id that includes illegal characters such as '/'.")