[#382] Fix request type determination

Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
This commit is contained in:
Marina Biryukova 2024-05-06 11:42:08 +03:00
parent 2ab655b909
commit c43ef040dc
2 changed files with 84 additions and 2 deletions

View file

@ -215,11 +215,11 @@ func getBucketObject(r *http.Request, domains []string) (reqType ReqType, bktNam
return noneType, "", ""
}
if ind := strings.IndexByte(bktObj, '/'); ind != -1 {
if ind := strings.IndexByte(bktObj, '/'); ind != -1 && bktObj[ind+1:] != "" {
return objectType, bktObj[:ind], bktObj[ind+1:]
}
return bucketType, bktObj, ""
return bucketType, strings.TrimSuffix(bktObj, "/"), ""
}
func determineOperation(r *http.Request, reqType ReqType) (operation string) {