You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The parser specifies the line number where the error occurred but it does not match the line number of the .env file. This problem only happens on Windows.
For example, I have the following .env file:
KEY1 = 1
KEY2 = 2
asdasd
KEY3 = 3
KEY4 = 4
On testing this, the parser throws the following exception:
The parser found a line that has no key-value pair format. (Actual Value: asdasd, Line: 5)
So, it doesn't make sense, the error occurred on line 3 and not line 5. The funny thing is that this behavior only occurs on Windows but not on Linux. I tested this on a Linux distro like Linux Mint and the line number is correct.
According to the documentation, the value that represents the NewLine property in Windows is \r\n. Split method is receiving that value and returning empty substrings.
Why does it return empty substrings? I don't know yet.
The parser specifies the line number where the error occurred but it does not match the line number of the .env file. This problem only happens on Windows.
For example, I have the following .env file:
On testing this, the parser throws the following exception:
So, it doesn't make sense, the error occurred on line 3 and not line 5. The funny thing is that this behavior only occurs on Windows but not on Linux. I tested this on a Linux distro like Linux Mint and the line number is correct.
It seems that the problem is this line:
dotenv.core/src/Parser/EnvParser.cs
Line 138 in d9c5d47
According to the documentation, the value that represents the
NewLine
property in Windows is\r\n
.Split
method is receiving that value and returning empty substrings.Why does it return empty substrings? I don't know yet.
If we have such a string:
Split
method splits the string in this way:In Linux this problem does not happen, because the
NewLine
property returns\n
, so thesplit
method will not return empty substrings.I will make a PR to solve this issue.
The text was updated successfully, but these errors were encountered: