Fix suffix normalization

This commit is contained in:
Andreas Dueren
2025-11-04 19:11:44 -06:00
parent 55808e9afa
commit 6cf536bc67
4 changed files with 11 additions and 7 deletions

View File

@@ -110,13 +110,13 @@ FAMILY_HOST="$(resolve_http_hostname "FAMILY_DOMAIN" "family.${APP_FQDN}")"
normalize_host() {
local host="$1"
# Replace trailing shared domain with the app domain if present (allows values like cast.ente)
local suffix=".${APP_FQDN#*.}"
case "$host" in
*".${APP_FQDN#*.}")
printf '%s\n' "${host%.*}.${APP_FQDN#*.}"
*"$suffix")
printf '%s\n' "$host"
;;
*)
printf '%s\n' "$host"
printf '%s%s\n' "$host" "$suffix"
;;
esac
}