jammsen / docker-palworld-dedicated-server

Docker container to easily provision and manage Palworld Dedicated Server
https://hub.docker.com/r/jammsen/palworld-dedicated-server
MIT License
898 stars 151 forks source link

[Bug Report] Slash in server name crashes #202

Closed marlub closed 4 months ago

marlub commented 4 months ago

Have you read the Important information text above

Current behavior

Using this .env entry as example SERVER_NAME="[EU/DE]" crashes the container with this message:

sed: -e expression #1, char 38: unknown option to `s'

As soon as I change the server name to this SERVER_NAME="[EU|DE]" it works.

Desired behavior

I think common characters like slashes should work on server name env variable.

Links to screenshots

No response

To Reproduce

Steps to reproduce the behavior:

Software setup

Hardware setup

Additional context

No response

jammsen commented 4 months ago

Hello @marlub - That is because the SED uses the delimiter / for Regex. See here: https://github.com/jammsen/docker-palworld-dedicated-server/blob/develop/includes/config.sh#L252

If if would go for # or another character the issue of someone else would be "Cant use # in Servername". One character it has to be and i went with "/". You could try to use escaping in your Servername variable meaning using instead of / the use of \/

Hope that helps.

marlub commented 4 months ago

Hey @jammsen, thanks for your clarification. GitHub does not correctly print the backslash for me, which I think you wrote. Escaping myself works fine.

Little bit odd, as this worked yesterday with the latest image from before 13.02 04:34 CET.

Maybe I am wrong but a character like ; or ° sounds less conflict likely for me than /. On the other hand, slash is the common delimiter.

marlub commented 4 months ago

Another approach is to escape the delimiter systematically. You could do something like this for example:

SERVER_NAME=$(echo ${SERVER_NAME} | sed -e "s#/#\\\/#g")
sed -E -i "s/ServerName=\"[^\"]*\"/ServerName=\"$SERVER_NAME\"/" "$GAME_SETTINGS_FILE"
jammsen commented 4 months ago

I like having / as the delimiter, but thanks input, glad that escaping works.

If you like this project, please consider giving this repo and the Docker-Hub-Repo a Star.