From de487d049c75d1fc1fe443f6fe92b97098a51cb0 Mon Sep 17 00:00:00 2001 From: WLTBAgent Date: Mon, 23 Feb 2026 22:10:19 +0000 Subject: [PATCH] Fix build.sh to handle passwords with # character Use heredoc to write ldflags to temp file. This allows passwords containing # (hash) characters to be embedded correctly. Known limitation: Passwords with both spaces AND quotes together may still fail. Most other special characters work fine. --- build.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 23765d7..bef443c 100755 --- a/build.sh +++ b/build.sh @@ -107,9 +107,23 @@ echo "Building nextcloud-mail..." cd "$SCRIPT_DIR/tools/go/nextcloud-mail" # Build with compile-time credentials -# Note: This simple approach works for most passwords but may fail with -# passwords containing spaces, double quotes, or $ characters -go build -ldflags="-X main.BuildIMAPServer=$IMAP_SERVER -X main.BuildIMAPPort=$IMAP_PORT -X main.BuildIMAPUser=$IMAP_USER -X main.BuildIMAPPassword=$IMAP_PASS -X main.BuildSMTPServer=$SMTP_SERVER -X main.BuildSMTPPort=$SMTP_PORT -X main.BuildSMTPUser=$SMTP_USER -X main.BuildSMTPPassword=$SMTP_PASS -X main.BuildUseSSL=$USE_SSL -X main.BuildIgnoreCerts=$IGNORE_CERTS" -o ~/bin/nextcloud-mail . +# Use heredoc to write ldflags to temp file - handles # character +LDFLAGS_FILE="/tmp/nextcloud-mail-ldflags.$$" +cat > "$LDFLAGS_FILE" <