Conversation
Fixes issue #28: env_file and env_file_path now strip trailing carriage returns from each line, which GitHub's web form stores when editing multi-line secrets. Every affected line is reported, matching the behavior of trim_inputs for whitespace issues. The fix: - Detects trailing \r on each line in load_env_file - Strips it before blank/comment/format checks - Counts and reports stripped lines to alert users of the issue - Works for both env_file and env_file_path inputs - Does not affect LF-only input (no report issued) Tests added: - CRLF values are exported without the \r - Multiple CRLF lines are counted and reported correctly - LF-only input does not trigger a report - CRLF comment lines are still skipped - Both env_file and env_file_path handle CRLF correctly Closes #28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Strip CRLF line endings from environment variables
Problem
When users edit multi-line GitHub secrets or environment variables via the repository settings web form, GitHub stores them with CRLF (carriage return + line feed) line endings. The
env_fileandenv_file_pathinputs were not stripping the trailing\rcharacters, so:strconv.Atoi: parsing "2\r"errors for numeric values\rat the end are rejected as invalidSolution
Modified
load_env_file()inscripts/docker-entrypoint.shto:\rfrom each line before validation and exporttrim_inputs()for whitespace problemsThe fix applies to both
env_file(inline secrets) andenv_file_path(file-based variables).Testing
Added 10 new tests covering:
\renv_fileandenv_file_pathhandle CRLF correctlyVerification: All 8 CRLF-related tests fail without the fix and pass with it.
Total tests: 67 → 77 (10 new tests added)
Lint: Passes
Closes #28