fix(release): publish-gitea.sh 修复含空格文件名上传失败(暂存去空格副本 + 点号命名)
This commit is contained in:
1 parent
7bc2dee8b2
commit
33a27ba31b
1 file changed
+5
-2
@@ -51,10 +51,13 @@ fi
|
|||||||
|
|
||||||
for ASSET in "$@"; do
|
for ASSET in "$@"; do
|
||||||
[[ -f "$ASSET" ]] || { echo "skip missing asset: $ASSET" >&2; continue; }
|
[[ -f "$ASSET" ]] || { echo "skip missing asset: $ASSET" >&2; continue; }
|
||||||
NAME=$(basename "$ASSET")
|
NAME=$(basename "$ASSET" | tr ' ' '.')
|
||||||
|
STAGED=$(mktemp "${TMPDIR:-/tmp}/upload.XXXXXX.${NAME##*.}")
|
||||||
|
cp "$ASSET" "$STAGED"
|
||||||
CODE=$(curl -s -o /dev/null -w '%{http_code}' --max-time 600 "${AUTH[@]}" \
|
CODE=$(curl -s -o /dev/null -w '%{http_code}' --max-time 600 "${AUTH[@]}" \
|
||||||
-F "attachment=@$ASSET" \
|
-F "attachment=@$STAGED" \
|
||||||
"$GITEA/repos/$REPO/releases/$RELEASE_ID/assets?name=$NAME")
|
"$GITEA/repos/$REPO/releases/$RELEASE_ID/assets?name=$NAME")
|
||||||
|
rm -f "$STAGED"
|
||||||
echo "upload $NAME -> HTTP $CODE"
|
echo "upload $NAME -> HTTP $CODE"
|
||||||
[[ "$CODE" == 2* ]] || { echo "upload failed: $NAME" >&2; exit 1; }
|
[[ "$CODE" == 2* ]] || { echo "upload failed: $NAME" >&2; exit 1; }
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in new issue
Block a user