diff --git a/hack/upload b/hack/upload index 10a685dc9fb0c..7179fc4fc3d9c 100755 --- a/hack/upload +++ b/hack/upload @@ -21,7 +21,13 @@ if [[ -z "${DEST}" ]]; then fi if [[ "${DEST:0:5}" == "s3://" ]]; then - aws s3 sync ${PUBLIC:+--acl public-read} ${SRC} ${DEST} + acl_flag="${PUBLIC:+--acl public-read}" + bucket=$(echo "${DEST}" | cut -d/ -f3) + # S3 buckets with BucketOwnerEnforced error on attempts to set ACLs + if aws s3api get-bucket-ownership-controls --bucket "${bucket}" | grep -q "BucketOwnerEnforced" 2>/dev/null; then + acl_flag="" + fi + aws s3 sync ${acl_flag} ${SRC} ${DEST} exit 0 fi