From 7b4dea4e3e5e36042467c7ce8efc126e8748ff49 Mon Sep 17 00:00:00 2001 From: Arlind Date: Mon, 16 Jun 2025 10:10:15 +0200 Subject: [PATCH] Update .gitea/workflows/ci.yml --- .gitea/workflows/ci.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 486a3dc..290e478 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -610,11 +610,17 @@ jobs: sanitize_filename() { echo "$1" | \ - sed -e 's#[\\/:\*\?"<>|]#-#g' -e 's#%#_#g' | \ + tr -d '\r\n' | \ + sed -e 's#[\\/:\*\?"<>|]#-#g' | \ tr -s ' ' | \ sed 's/^ *//;s/ *$//' } + url_encode_path() { + local raw_path="$1" + echo "$raw_path" | tr -d '\r\n' | jq -sRr @uri + } + SKINS_JSON_FILE="${{ github.workspace }}/.gitea/workflows/skins.json" DESC_FILE=$(mktemp) @@ -660,7 +666,8 @@ jobs: } fi - base_path=$(printf "%s/%s" "$skin" "$skin_header" | sed 's/ /%20/g') + raw_path="$(printf "%s/%s" "$skin" "$skin_header" | sed 's/^ *//;s/ *$//')" + base_path=$(url_encode_path "$raw_path") echo "## [$skin_header]($REGISTRY_URL/$USER_REPOSITORY/media/tag/$new_tag/export/${base_path}.osk)" >> "$README_PATH" echo "" >> "$README_PATH" @@ -671,7 +678,7 @@ jobs: author_line=$(grep -i '^[[:space:]]*Author:' "$ini_file" | head -n1 2>/dev/null || true) if [ -n "$author_line" ]; then author="${author_line#*:}" - author="$(echo "$author" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + author="$(sanitize_filename "$author")" [ -n "$author" ] && { echo "**Author:** $author" >> "$README_PATH"; echo "" >> "$README_PATH"; } fi fi @@ -709,7 +716,8 @@ jobs: } fi - base_path=$(printf "%s/%s" "$skin" "$skin_header" | sed 's/ /%20/g') + raw_path="$(printf "%s/%s" "$skin" "$skin_header" | sed 's/^ *//;s/ *$//')" + base_path=$(url_encode_path "$raw_path") echo "## [$skin_header]($REGISTRY_URL/$USER_REPOSITORY/media/tag/$new_tag/export/${base_path}.osk)" >> "$README_PATH" echo "" >> "$README_PATH" @@ -717,7 +725,7 @@ jobs: author_line=$(grep -i '^[[:space:]]*Author:' "$ini_file" | head -n1 2>/dev/null || true) if [ -n "$author_line" ]; then author="${author_line#*:}" - author="$(echo "$author" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + author="$(sanitize_filename "$author")" [ -n "$author" ] && { echo "**Author:** $author" >> "$README_PATH"; echo "" >> "$README_PATH"; } fi fi