Skip to content

Commit f1328b3

Browse files
committed
trying with strict truncation
1 parent 45ddd81 commit f1328b3

File tree

2 files changed

+43
-22
lines changed

2 files changed

+43
-22
lines changed

.github/workflows/build-release.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,19 @@ jobs:
9090
rm -rf "$STEAM_CMD"
9191
rm -rf "$STEAM_DIR"
9292
rm -rf "$STEAM_TEMP"
93-
94-
- name: Publish description via Steam Web API
95-
if: ${{ inputs.update-description == 'true' }}
96-
env:
97-
STEAM_WEB_API_KEY: ${{ secrets.STEAM_WEB_API_KEY }}
98-
APPID: "529340"
99-
MOD_ID: ${{ steps.metadata.outputs.mod-id }}
100-
run: |
101-
desc="$(< ../steam-release/STEAM_PAGE.bbcode)"
102-
curl -X POST "https://api.steampowered.com/ISteamRemoteStorage/SetPublishedFileDetails/v1/" \
103-
-d "key=${STEAM_WEB_API_KEY}" \
104-
-d "appid=${APPID}" \
105-
-d "publishedfileid=${MOD_ID}" \
106-
--data-urlencode "description=${desc}" \
107-
|| exit 1
93+
94+
#This method does not exist... T_T
95+
# - name: Publish description via Steam Web API
96+
# if: ${{ inputs.update-description == 'true' }}
97+
# env:
98+
# STEAM_WEB_API_KEY: ${{ secrets.STEAM_WEB_API_KEY }}
99+
# APPID: "529340"
100+
# MOD_ID: ${{ steps.metadata.outputs.mod-id }}
101+
# run: |
102+
# desc="$(< ../steam-release/STEAM_PAGE.bbcode)"
103+
# curl -X POST "https://api.steampowered.com/ISteamRemoteStorage/SetPublishedFileDetails/v1/" \
104+
# -d "key=${STEAM_WEB_API_KEY}" \
105+
# -d "appid=${APPID}" \
106+
# -d "publishedfileid=${MOD_ID}" \
107+
# --data-urlencode "description=${desc}" \
108+
# || exit 1

script/create-release-vdf.sh

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,40 @@ else
2222
fi
2323

2424
# Check mod description
25-
#if [ -f "$3" ]; then
26-
# description=$(sed -e ':a;N;$!ba' -e 's/\r//g' -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/\n/\\n/g' "$3")
25+
if [ -f "$3" ]; then
26+
description=$(sed -e ':a;N;$!ba' -e 's/\r//g' -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/\n/\\n/g' "$3")
2727
# slurp entire file -e ':a;N;$!ba'
2828
# remove any stray CR (^M) -e 's/\r//g'
2929
# escape backslashes -e 's/\\/\\\\/g'
3030
# escape double-quotes -e 's/"/\\"/g'
3131
# escape newlines -e 's/\n/\\n/g'
3232
# echo ">>> DEBUG: first 200 chars of desc:" >&2
3333
# printf '%s' "$description" | cut -c1-200 >&2
34-
#else
35-
# printf 'Missing Steam description'
36-
# printf '\n'
37-
#fi
38-
description=""
34+
else
35+
printf 'Missing Steam description'
36+
printf '\n'
37+
fi
38+
# If you need to test with a blank description:
39+
#description=""
40+
41+
# After building $description (with all backslashes, quotes and newlines escaped):
42+
# 1) Measure its length in characters
43+
char_len=$(printf '%s' "$description" | wc -m)
44+
echo ">>> DEBUG: escaped description length = $char_len characters" >&2
45+
46+
# 2) Define your max in characters (e.g. 8000)
47+
MAX_CHARS=8000
48+
49+
# 3) If it’s too long, truncate to the first $MAX_CHARS characters
50+
if [ "$char_len" -gt "$MAX_CHARS" ]; then
51+
echo ">>> WARNING: description too long (${char_len} > ${MAX_CHARS}), truncating" >&2
52+
# cut -c works on characters
53+
description=$(printf '%s' "$description" | cut -c1-"$MAX_CHARS")
54+
# (optionally append an ellipsis)
55+
# description="${description}…"
56+
fi
57+
58+
3959

4060
# Clean up old file
4161
printf '' > workshop.vdf

0 commit comments

Comments
 (0)