Merge pull request #2536 from swordqiu/hotfix/qj-mkdir-empty-path

fix: bucket mkdir may create path with empty whitespaces
This commit is contained in:
yunion-ci-robot
2019-08-24 18:39:13 +08:00
committed by GitHub
+1 -4
View File
@@ -630,10 +630,7 @@ func (bucket *SBucket) PerformMakedir(
data jsonutils.JSONObject,
) (jsonutils.JSONObject, error) {
key, _ := data.GetString("key")
for len(key) > 0 && key[len(key)-1] == '/' {
key = key[:len(key)-1]
}
key = strings.Trim(key, " /")
if len(key) == 0 {
return nil, httperrors.NewInputParameterError("empty directory name")
}