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
A String envar that starts with a digit (0-9) followed by the second character being anyone of these...
return r == 'k' || r == 'K' || r == 'm' || r == 'M' || r == 'g' || r == 'G' || r == 't' || r == 'T' || r == 'p' || r == 'P' || r == 'e' || r == 'E'
and has a length > 2, is incorrectly inferred as a number and not a string.
After stepping through the code isNumberSuffix() gets called but I feel like it should only infer it's a number if the suffix is at the end of the string.
Included nats-server -DV output
Included a [Minimal, Complete, and Verifiable example]
Versions of nats-server and affected client libraries used: latest
OS/Container environment:
Steps or code to reproduce the issue:
Here is a unit test that shows the issue. It can go in conf/parse_test.go
Received err: variable reference for '__UNIQ22__' on line 1 could not be parsed: Parse error on line 1: 'Expected a top-level value to end with a new line, comment or EOF, but got 'P' instead.'
The text was updated successfully, but these errors were encountered:
@julian-dolce-form3 As you can see in parse_test.go, we have a test called TestEnvVariableStringStartingWithNumber that catches that we fail if a string (without quotes) starts with a number. To parse the string which starts with a number one would have to use quotes, like in test TestEnvVariableStringStartingWithNumberUsingQuotes.
Would that be possible for you to set the env variable surrounded with quotes '?
If a configuration variable starts with numbers and has a character
that such as K/k/G/g/etc.. it would assume that it was a number
(expressed in Kb, Gb, etc..).
This PR checks that if the special characters are not the suffix,
that is, the variable does not end after those characters, then
the parsing will treat the whole thing as a string.
Resolves#3431
Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
Defect
A String envar that starts with a digit (0-9) followed by the second character being anyone of these...
and has a length > 2, is incorrectly inferred as a number and not a string.
After stepping through the code isNumberSuffix() gets called but I feel like it should only infer it's a number if the suffix is at the end of the string.
nats-server -DV
outputVersions of
nats-server
and affected client libraries used: latestOS/Container environment:
Steps or code to reproduce the issue:
Here is a unit test that shows the issue. It can go in
conf/parse_test.go
Expected result:
The test passes
Actual result:
Errors with
The text was updated successfully, but these errors were encountered: