test: list-objects param add change

This commit is contained in:
Luke McCrone
2025-01-06 22:09:19 -03:00
parent 5e83419e2c
commit b983dadce9
2 changed files with 12 additions and 25 deletions

View File

@@ -36,19 +36,19 @@ canonical_request="GET
/$bucket_name
"
queries=""
if [ "$MARKER" != "" ]; then
add_parameter "canonical_request" "marker=$marker"
queries=$(add_parameter "$queries" "marker=$marker")
fi
if [ "$CONTINUATION_TOKEN" != "" ]; then
add_parameter "canonical_request" "continuation-token=$continuation_token"
queries=$(add_parameter "$queries" "continuation-token=$continuation_token")
fi
if [ "$version_two" != "FALSE" ]; then
add_parameter "canonical_request" "list-type=2"
queries=$(add_parameter "$queries" "list-type=2")
fi
if [ "$max_keys" -ne 0 ]; then
add_parameter "canonical_request" "max-keys=$max_keys"
queries=$(add_parameter "$queries" "max-keys=$max_keys")
fi
first_param_added="false"
canonical_request+="
host:$host
@@ -61,19 +61,9 @@ create_canonical_hash_sts_and_signature
curl_command+=(curl -ks -w "\"%{http_code}\"")
url="'$AWS_ENDPOINT_URL/$bucket_name"
if [ "$MARKER" != "" ]; then
add_parameter "url" "marker=$marker"
if [ "$queries" != "" ]; then
url+="?$queries"
fi
if [ "$CONTINUATION_TOKEN" != "" ]; then
add_parameter "url" "continuation-token=$continuation_token"
fi
if [ "$version_two" != "FALSE" ]; then
add_parameter "url" "list-type=2"
fi
if [ "$max_keys" -ne 0 ]; then
add_parameter "url" "max-keys=$max_keys"
fi
first_param_added="false"
url+="'"
curl_command+=("$url")
curl_command+=(-H "\"Authorization: AWS4-HMAC-SHA256 Credential=$aws_access_key_id/$year_month_day/$aws_region/s3/aws4_request,SignedHeaders=host;x-amz-content-sha256;x-amz-date,Signature=$signature\""

View File

@@ -70,13 +70,10 @@ add_parameter() {
if [ "$#" -ne 2 ]; then
return
fi
if [ "$first_param_added" != "true" ]; then
if [ "$1" == "url" ]; then
eval "$1"+='?'
fi
eval "$1"+="$2"
first_param_added="true"
else
eval "$1"+="'&$2'"
current_string="$1"
if [ "$current_string" != "" ]; then
current_string+="&"
fi
current_string+="$2"
echo "$current_string"
}