Skip to content

[BUG] Windows secrets upload adds newline at the end #485

@KanishkaHalder1771

Description

@KanishkaHalder1771

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions