Throw proper S3 error code for invalid buck name

INVALID_BUCKET_NAME for container creation request, else NO_SUCH_BUCKET
pull/207/merge
Chaithanya Ganta 2017-05-26 11:52:00 +05:30 zatwierdzone przez Andrew Gaul
rodzic 6b92cc06f4
commit 84885fa8cd
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -559,8 +559,15 @@ public class S3ProxyHandler {
}
}
// Validate container name
if (!uri.equals("/") && !isValidContainer(path[1])) {
throw new S3Exception(S3ErrorCode.INVALID_BUCKET_NAME);
if (method.equals("PUT") &&
(path.length <= 2 || path[2].isEmpty()) &&
!("".equals(request.getParameter("acl")))) {
throw new S3Exception(S3ErrorCode.INVALID_BUCKET_NAME);
} else {
throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET);
}
}
String uploadId = request.getParameter("uploadId");