Skip to content
New issue

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

Fixes ini file parsing for cases when Right Hand Value is missed in the last statement of the ini file #3596

Merged
merged 3 commits into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
### SDK Enhancements

### SDK Bugs
* `internal/ini`: Fixes ini file parsing for cases when Right Hand Value is missed in the last statement of the ini file ([#3596](https://github.com/aws/aws-sdk-go/pull/3596))
* related to [#2800](https://github.com/aws/aws-sdk-go/issues/2800)
7 changes: 4 additions & 3 deletions internal/ini/ini_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ var parseTable = map[ASTKind]map[TokenType]int{
TokenNone: MarkCompleteState,
},
ASTKindEqualExpr: map[TokenType]int{
TokenLit: ValueState,
TokenWS: SkipTokenState,
TokenNL: SkipState,
TokenLit: ValueState,
TokenWS: SkipTokenState,
TokenNL: SkipState,
TokenNone: SkipState,
},
ASTKindStatement: map[TokenType]int{
TokenLit: SectionState,
Expand Down
13 changes: 13 additions & 0 deletions internal/ini/ini_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,19 @@ output = json
newExprStatement(outputEQExpr),
},
},
{
name: "missing right hand expression in the last statement in the file",
r: bytes.NewBuffer([]byte(
`[default]
region = us-west-2
s3 =`)),
expectedStack: []AST{
newCompletedSectionStatement(
defaultProfileStmt,
),
newExprStatement(noQuotesRegionEQRegion),
},
},
}

for i, c := range cases {
Expand Down