fix(release): URL-encode release asset names
ci / test (pull_request) Successful in 44s

The release upload passed basename() raw in the name= query param, so a '+'
in the signed xpi filename (ismis-helper-1.4.0-an+fx.xpi) was URL-decoded to a
space ('ismis-helper-1.4.0-an fx.xpi'). Encode the name with
urllib.parse.quote before the request.
This commit is contained in:
2026-08-20 12:48:37 +08:00
parent 7adad7cbc8
commit 43ee3e035e
+6 -1
View File
@@ -76,8 +76,13 @@ jobs:
# Attach zips and the signed xpi (if present) as release assets # Attach zips and the signed xpi (if present) as release assets
for f in dist/*.zip dist/*.xpi; do for f in dist/*.zip dist/*.xpi; do
[ -f "$f" ] || continue [ -f "$f" ] || continue
NAME="$(basename "$f")"
# URL-encode the asset name so characters like '+' (in
# 'ismis-helper-1.4.0-an+fx.xpi') survive the query string instead
# of being decoded to a space.
ENC=$(python3 -c "import urllib.parse,sys; print(urllib.parse.quote(sys.argv[1], safe=''))" "$NAME")
curl -sS -X POST \ curl -sS -X POST \
-H "Authorization: token ${GITHUB_TOKEN}" \ -H "Authorization: token ${GITHUB_TOKEN}" \
-F "attachment=@${f}" \ -F "attachment=@${f}" \
"${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=$(basename "${f}")" "${API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${ENC}"
done done