Fixed URLs by encoding spaces

This commit is contained in:
Thorsten Sommer 2024-06-21 22:25:02 +02:00
parent 47309fd7ea
commit 81ac80f739
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -648,6 +648,18 @@ jobs:
# Here, we create the JSON object: # Here, we create the JSON object:
platforms_json=$(jq -n '{}') platforms_json=$(jq -n '{}')
# Define the urlencode function:
urlencode() {
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%02X' "'$c" ;;
esac
done
}
# Iterate over all signature files: # Iterate over all signature files:
while IFS= read -r -d '' sig_file; do while IFS= read -r -d '' sig_file; do
@ -678,7 +690,8 @@ jobs:
# Extract the artifact name and create the URL: # Extract the artifact name and create the URL:
artifact_name=$(basename "$sig_file" .sig) artifact_name=$(basename "$sig_file" .sig)
url="https://github.com/MindWorkAI/AI-Studio/releases/download/$FORMATTED_VERSION/$artifact_name" encoded_artifact_name=$(urlencode "$artifact_name")
url="https://github.com/MindWorkAI/AI-Studio/releases/download/$FORMATTED_VERSION/$encoded_artifact_name"
# Build the JSON object: # Build the JSON object:
platforms_json=$(echo "$platforms_json" | jq --arg platform "$platform" --arg signature "$signature" --arg url "$url" '.[$platform] = {"signature": $signature, "url": $url}') platforms_json=$(echo "$platforms_json" | jq --arg platform "$platform" --arg signature "$signature" --arg url "$url" '.[$platform] = {"signature": $signature, "url": $url}')