Fix variable option values starting with a number or boolean#5113
Open
eyupcanakman wants to merge 1 commit into
Open
Fix variable option values starting with a number or boolean#5113eyupcanakman wants to merge 1 commit into
eyupcanakman wants to merge 1 commit into
Conversation
A variable value that starts with a number or boolean but has more characters was rejected with an error. These values are now read as strings. Fixes Orange-OpenSource#5028
jcamiel
reviewed
Jun 22, 2026
jcamiel
left a comment
Collaborator
There was a problem hiding this comment.
Hi @eyupcanakman thanks for the PR, I've a quick comment on it, but @fabricereix will review it more thoughtfully
| // the start of an unquoted string, so return a recoverable error to fall back to it. | ||
| fn literal_value<T>(reader: &mut Reader, value: T) -> ParseResult<T> { | ||
| match reader.peek() { | ||
| None | Some(' ' | '\t' | '\r' | '\n' | '#') => Ok(value), |
Collaborator
There was a problem hiding this comment.
Unless mistake, I think we should not take # into account here:
GET http://localhost:8000
[Options]
variable: foo=true#this_is_not_a_commentfoo should be equal to the string true#this_is_not_a_comment and not be parsed as a bool
Collaborator
There was a problem hiding this comment.
At first, I would have excluded it.
But in the shell, it is not treated as comment
$ value=true#this_is_not_a_comment
$ echo "$value"
true#this_is_not_a_comment
Collaborator
There was a problem hiding this comment.
By "not take # into account here" I mean not use in this pattern Some(' ' | '\t' | '\r' | '\n' | '#').
variable: foo=true#this_is_not_a_comment should create a string variable with value true#this_is_not_a_comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A variable value in an
[Options]section that starts with a number or boolean but continues with other characters, like11aaortrue_is_true, was rejected with anexpecting 'line_terminator'error.These values are now read as strings.
Fixes #5028