Fix Forgejo CI: URL-encode filenames with spaces for upload
Some checks failed
Release / build-and-release (push) Has been cancelled

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
le king fu 2026-02-26 21:26:40 -05:00
parent 66b25dd707
commit 530c556e95

View file

@ -142,10 +142,11 @@ jobs:
# Upload all assets # Upload all assets
for file in release-assets/*; do for file in release-assets/*; do
FILENAME=$(basename "$file") FILENAME=$(basename "$file")
ENCODED_FILENAME=$(printf '%s' "$FILENAME" | jq -sRr @uri)
FILESIZE=$(stat -c%s "$file") FILESIZE=$(stat -c%s "$file")
echo "Uploading: $FILENAME (${FILESIZE} bytes)" echo "Uploading: $FILENAME (${FILESIZE} bytes)"
HTTP_CODE=$(curl -w "%{http_code}" --max-time 300 -X POST \ HTTP_CODE=$(curl -w "%{http_code}" --max-time 300 -X POST \
"${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}" \ "${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${ENCODED_FILENAME}" \
-H "Authorization: token ${FORGEJO_TOKEN}" \ -H "Authorization: token ${FORGEJO_TOKEN}" \
-H "Content-Type: application/octet-stream" \ -H "Content-Type: application/octet-stream" \
--data-binary "@${file}" \ --data-binary "@${file}" \