We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given a .env with only one line: FOO = "\\"
FOO = "\\"
godotenv.Read(".env") will return an error because the prevChar == '\\', even though it's escaped.
prevChar == '\\'
// lookup quoted string terminator for i := 1; i < len(src); i++ { if char := src[i]; char != quote { continue } // skip escaped quote symbol (\" or \', depends on quote) if prevChar := src[i-1]; prevChar == '\\' { continue } // trim quotes trimFunc := isCharFunc(rune(quote)) value = string(bytes.TrimLeftFunc(bytes.TrimRightFunc(src[0:i], trimFunc), trimFunc)) if quote == prefixDoubleQuote { // unescape newlines for double quote (this is compat feature) // and expand environment variables value = expandVariables(expandEscapes(value), vars) } return value, src[i+1:], nil }
extractVarValue should instead check whether the quote symbol is preceded by an odd number of backslashes (escaped) or an even number (not escaped).
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Given a .env with only one line:
FOO = "\\"
godotenv.Read(".env") will return an error because the
prevChar == '\\'
, even though it's escaped.extractVarValue should instead check whether the quote symbol is preceded by an odd number of backslashes (escaped) or an even number (not escaped).
The text was updated successfully, but these errors were encountered: