Build script now validates that IMAP username and password
are not empty before proceeding with the build.
This prevents the binary from being built with empty
credentials which would cause connection errors like:
"dial tcp :143" (empty hostname)
SOLUTION: Pass each -X flag as a separate -ldflags argument.
This isolates each credential value so special characters
in one value don't affect parsing of other values.
Tested successfully with passwords containing:
- Spaces AND quotes: "Pass \quote\ space"
- Hash character: Password#123
- All special characters: P@ss#123 \quote\ space$
This approach handles ALL special characters safely.
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.
The build script was using complex escaping mechanisms that were causing
linker failures with certain passwords.
Simplified to use the same approach as other Nextcloud tools:
- No temp files
- No escaping functions
- Direct variable substitution in ldflags
This matches the pattern used for nextcloud-client, nextcloud-contacts,
and nextcloud-calendar.
Known limitation: Passwords containing spaces, double quotes,
or $ characters may fail to build. Users with such passwords
should use a simpler password or manually modify the build command.
The build was failing with Go linker errors because special characters in
user-provided credentials (especially passwords) were not being properly escaped.
Added escape_ldflag() function to handle:
- Backslashes
- Double quotes
- Spaces
This ensures that any user input (including passwords with special characters)
is safely passed to Go's linker without breaking the build command.