diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 7fba4842..70922ccf 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -648,6 +648,18 @@ jobs: # Here, we create the JSON object: 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: while IFS= read -r -d '' sig_file; do @@ -678,7 +690,8 @@ jobs: # Extract the artifact name and create the URL: 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: platforms_json=$(echo "$platforms_json" | jq --arg platform "$platform" --arg signature "$signature" --arg url "$url" '.[$platform] = {"signature": $signature, "url": $url}')