Author SHA1 Message Date
JakeBreath ecac4cb8b4 Fix the release asset upload for names with spaces
CI / Frontend build & lint (push) Successful in 23s
CI / Backend tests (push) Successful in 2m4s
curl exit 3 (malformed URL) on 'J621 Setup 0.1.1.exe': percent-encode the
asset name in the query string.

Also replace assets instead of skipping them on re-runs: NSIS builds are
not bit-reproducible, so latest.yml/latest-linux.yml must reference the
installers produced by the same run. Existing assets are deleted by id
before the fresh upload.
2026-09-23 07:14:19 -05:00
+19 -6
View File
@@ -162,8 +162,7 @@ jobs:
fi fi
EXISTING="$(curl -sf -H "$AUTH" "$API/releases/$RELEASE_ID/assets" \ EXISTING="$(curl -sf -H "$AUTH" "$API/releases/$RELEASE_ID/assets" \
| python3 -c 'import json,sys; print("\n".join(a["name"] for a in json.load(sys.stdin)))' \ || echo '[]')"
|| true)"
for FILE in desktop/release/*"$VERSION"*.deb \ for FILE in desktop/release/*"$VERSION"*.deb \
desktop/release/*"$VERSION"*.pkg.tar.zst \ desktop/release/*"$VERSION"*.pkg.tar.zst \
desktop/release/latest-linux.yml \ desktop/release/latest-linux.yml \
@@ -172,11 +171,25 @@ jobs:
desktop/release/*"$VERSION"*.exe.blockmap; do desktop/release/*"$VERSION"*.exe.blockmap; do
[ -e "$FILE" ] || continue [ -e "$FILE" ] || continue
NAME="$(basename "$FILE")" NAME="$(basename "$FILE")"
case "$EXISTING" in # Replace the asset when it is already there: latest*.yml must
*"$NAME"*) echo " already attached: $NAME"; continue ;; # reference the installers built by *this* run (NSIS builds are
esac # not bit-reproducible), so old copies are deleted first.
ASSET_ID="$(printf '%s' "$EXISTING" | python3 -c '
import json, sys
name = sys.argv[1]
print(next((str(a["id"]) for a in json.load(sys.stdin) if a["name"] == name), ""))
' "$NAME")"
if [ -n "$ASSET_ID" ]; then
echo " replacing $NAME"
curl -sf -X DELETE -H "$AUTH" \
"$API/releases/$RELEASE_ID/assets/$ASSET_ID" >/dev/null
else
echo " attaching $NAME" echo " attaching $NAME"
fi
# Names like "J621 Setup 0.1.1.exe" contain spaces: encode them
# or curl refuses the URL (exit 3).
ENCODED="$(python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1]))' "$NAME")"
curl -sf -X POST -H "$AUTH" -H "Content-Type: application/octet-stream" \ curl -sf -X POST -H "$AUTH" -H "Content-Type: application/octet-stream" \
--data-binary @"$FILE" "$API/releases/$RELEASE_ID/assets?name=$NAME" >/dev/null --data-binary @"$FILE" "$API/releases/$RELEASE_ID/assets?name=$ENCODED" >/dev/null
done done
echo "Release: ${{ github.server_url }}/${{ github.repository }}/releases/tag/$TAG" echo "Release: ${{ github.server_url }}/${{ github.repository }}/releases/tag/$TAG"