Escape unicode in server.properties by default when less than 1.20 (#2480)

This commit is contained in:
Geoff Bourne
2023-11-11 14:05:00 -06:00
committed by GitHub
parent f5c332736d
commit aba27ad444
2 changed files with 9 additions and 2 deletions

View File

@@ -25,6 +25,7 @@ function customizeServerProps {
# normalize MOTD
if [[ ${TYPE^^} = LIMBO ]]; then
if [[ $MOTD ]] && ! [[ $MOTD =~ ^{ ]]; then
# shellcheck disable=SC2089
MOTD="{\"text\":\"${MOTD}\"}"
fi
fi
@@ -110,11 +111,17 @@ function customizeServerProps {
setPropertiesArgs=(
--definitions "/image/property-definitions.json"
--escape-unicode="${SERVER_PROPERTIES_ESCAPE_UNICODE:-false}"
)
if [[ -v CUSTOM_SERVER_PROPERTIES ]]; then
setPropertiesArgs+=(--custom-properties "$CUSTOM_SERVER_PROPERTIES")
fi
if [[ -v SERVER_PROPERTIES_ESCAPE_UNICODE ]]; then
if isTrue "$SERVER_PROPERTIES_ESCAPE_UNICODE"; then
setPropertiesArgs+=(--escape-unicode)
fi
elif versionLessThan '1.20'; then
setPropertiesArgs+=(--escape-unicode)
fi
handleDebugMode
if ! mc-image-helper set-properties "${setPropertiesArgs[@]}" "$SERVER_PROPERTIES"; then