diff --git a/pi/bin/video-publisher.sh b/pi/bin/video-publisher.sh index 3b245198..49b35e93 100644 --- a/pi/bin/video-publisher.sh +++ b/pi/bin/video-publisher.sh @@ -14,6 +14,10 @@ fi # Strip any CRLFs to avoid sourcing a PUBLISH_URL with a stray carriage return in the name. source <(tr -d '\r' < "$ENV_FILE") PUBLISH_URL="${PUBLISH_URL:-}" +if [[ -z "${PUBLISH_URL}" ]]; then + # Fallback parser in case sourcing missed due to weird whitespace/BOM + PUBLISH_URL="$(grep -E '^PUBLISH_URL=' "$ENV_FILE" | head -n1 | cut -d= -f2- | tr -d '\r')" +fi if [[ -z "${PUBLISH_URL}" ]]; then echo "PUBLISH_URL not set in ${ENV_FILE}; contents:" >&2 sed -n '1,200p' "$ENV_FILE" >&2