DopplerHQ / DopplerHQ/cli

[BUG] Windows secrets upload adds newline at the end

Open
#485 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
396
Forks
83
Avg merge
1d 2h
Merged PRs (30d)
3

Description

Describe the bug
Running the following on Windows 11

doppler secrets upload .env

it should upload the environments to the remote. It does upload the envs but in the remote it adds a newline at the end. In the dashboard I can see that there is a newline at the end of every value (except for the last value). And after doing a upload if i do a download using doppler secrets download --no-file --format env-no-quotes > .env.new then also this file has a \n attached to it at the end of each value.

Possible Cause:
Line Endings are not properly handled for Windows. So a interesting thing to point out that when I uploaded the .env my last env key_last=value_last line did not have a newline and in the remote dashboard the uploaded values that I say the key_last's value did not have a extra newline. Also I tried printing the exact raw file value that is sent to your api from the CLI so it comes out as this:

File contents (raw): "NEXT_PUBLIC_PRICE_PER_IMAGE=10\r\nENV=development\r\nNEXT_PUBLIC_BASE_URL=http://localhost:3011\r\nPROCESSING_API_URL=http://localhost:3011/process-image"

So my hunch is that on the backend its probably recognizing \r as the line-ending (older macOS line-ending) and removing only the \r part instead of the entire \r\n for Windows and hence the value has a trailing \n. Or might be something similar based on what I can see.

To Reproduce

  • Create .env file on Windows, add a few envs
NEXT_PUBLIC_SUPABASE_URL=https://test.api.co
PROCESSING_API_URL=https://test-api.com/process-image
  • upload using doppler secrets upload .env
  • download download --no-file --format env-no-quotes > .env.new
  • the downloaded files should have \n at the end

Expected behavior
The newline should not be present in the uploaded envs
Screenshots
Uploaded env:
Image

Downloaded env:
Image

Desktop (please complete the following information):

  • OS: Windows 11 Pro Insider Preview
  • OS Build: 27823.1000

CLI Version:
Version v3.73.1

Additional Context:
Please take a look at File I/O for windows, its a bit buggy. I use both MacOS and Windows to work on the same project sometimes and hence is difficult to make this work with Windows.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with doppler secrets upload .env on Windows using CRLF line endings, then run doppler secrets download --no-file --format env-no-quotes. Trace the CLI's upload and download file I/O and newline handling. Done means uploaded values and downloaded output contain no unintended trailing \n while preserving the final value.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.