Fix potential panic in `NewStreamTokenFromString` caused by off-by-one error
Line 291 could panic when trying to set `positions[i]` if `i == len(positions)`.
MODIFY
syncapi/types/types.go
syncapi/types/types.go
@@ -279,7 +279,7 @@ func NewStreamTokenFromString(tok string) (token StreamingToken, err error) {
parts := strings.Split(tok[1:], "_")
var positions [7]StreamPosition
for i, p := range parts {
- if i > len(positions) {
+ if i >= len(positions) {
break
}
var pos int

Fix potential panic in `NewStreamTokenFromString` caused by off-by-one error (#2196)

Line 291 could panic when trying to set `positions[i]` if `i == len(positions)`.