Skip to content

Commit

Permalink
test: list-objects param add change
Browse files Browse the repository at this point in the history
  • Loading branch information
lrm25 committed Jan 8, 2025
1 parent 5e83419 commit b983dad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
24 changes: 7 additions & 17 deletions tests/rest_scripts/list_objects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
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"
if [ "$queries" != "" ]; then
url+="?$queries"
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\""
Expand Down
13 changes: 5 additions & 8 deletions tests/rest_scripts/rest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit b983dad

Please sign in to comment.