Skip to content

fix: preserve trailing newlines in unchanged --set literals#770

Open
fuleinist wants to merge 1 commit into
jkroepke:mainfrom
fuleinist:fix/trailing-newline-escaping
Open

fix: preserve trailing newlines in unchanged --set literals#770
fuleinist wants to merge 1 commit into
jkroepke:mainfrom
fuleinist:fix/trailing-newline-escaping

Conversation

@fuleinist
Copy link
Copy Markdown

Fixes #752

Problem: Command substitution $( ) strips trailing newlines. When a --set literal ends with a newline (common with ArgoCD multi-line parameters), the decrypted value (same plain text, newline stripped) fails the equality check and triggers unnecessary comma escaping on output.

Fix: Add a length check via printf+wc-c so unchanged literals — including those that only differ by a stripped trailing newline — skip the sed escaping pass. Also add an explanatory comment.

Fixes jkroepke#752

Command substitution $( ) strips trailing newlines, so a --set literal
ending in a newline always fails the string-comparison equality check
and triggers unnecessary comma escaping on the output.

Add a length check via printf+wc-c so unchanged literals (including
those that only differ by a stripped trailing newline) skip escaping.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.00%. Comparing base (b9d433e) to head (ca5d6b0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #770   +/-   ##
=======================================
  Coverage   87.00%   87.00%           
=======================================
  Files          22       22           
  Lines         862      862           
=======================================
  Hits          750      750           
  Misses        112      112           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trailing newlines in literal breaks correct escaping of commas

1 participant