From 37c056afaf63676f0815a647e4c610da2d6cff8f Mon Sep 17 00:00:00 2001 From: tom goriunov Date: Wed, 11 Sep 2024 14:16:25 +0400 Subject: [PATCH] Favicon generator: escape special characters in master url (#2225) favicon generator: escape special characters in master url --- deploy/tools/favicon-generator/script.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deploy/tools/favicon-generator/script.sh b/deploy/tools/favicon-generator/script.sh index 69145399ed..444932c723 100755 --- a/deploy/tools/favicon-generator/script.sh +++ b/deploy/tools/favicon-generator/script.sh @@ -33,9 +33,12 @@ CONFIG_TEMPLATE_FILE="config.template.json" # Path to the generated config JSON file CONFIG_FILE="config.json" +# Escape special characters in MASTER_URL for sed +ESCAPED_MASTER_URL=$(printf '%s\n' "$MASTER_URL" | sed -e 's/[\/&]/\\&/g') + # Replace and placeholders in the JSON template file API_KEY_VALUE="$FAVICON_GENERATOR_API_KEY" -sed -e "s||$API_KEY_VALUE|" -e "s||$MASTER_URL|" "$CONFIG_TEMPLATE_FILE" > "$CONFIG_FILE" +sed -e "s||$API_KEY_VALUE|" -e "s||$ESCAPED_MASTER_URL|" "$CONFIG_TEMPLATE_FILE" > "$CONFIG_FILE" # Make the API POST request with JSON data from the config file echo "⏳ Making request to API..."