Skip to content

Commit

Permalink
Added check for escaped single quote in string
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Horwitz committed Jul 22, 2015
1 parent 9949de3 commit 96938e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [#3405](https://github.com/influxdb/influxdb/pull/3405): Prevent database panic when fields are missing. Thanks @jhorwit2
- [#3411](https://github.com/influxdb/influxdb/issues/3411): 500 timeout on write
- [#3420](https://github.com/influxdb/influxdb/pull/3420): Catch opentsdb malformed tags. Thanks @nathanielc.
- [#3404](https://github.com/influxdb/influxdb/pull/3404): Added support for escaped single quotes in query string. Thanks @jhorwit2

## v0.9.2 [unreleased]

Expand Down
2 changes: 2 additions & 0 deletions influxql/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ func ScanString(r io.RuneScanner) (string, error) {
_, _ = buf.WriteRune('\\')
} else if ch1 == '"' {
_, _ = buf.WriteRune('"')
} else if ch1 == '\'' {
_, _ = buf.WriteRune('\'')
} else {
return string(ch0) + string(ch1), errBadEscape
}
Expand Down
1 change: 1 addition & 0 deletions influxql/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ func TestScanString(t *testing.T) {
{in: `"foo\nbar"`, out: "foo\nbar"},
{in: `"foo\\bar"`, out: `foo\bar`},
{in: `"foo\"bar"`, out: `foo"bar`},
{in: `'foo\'bar'`, out: `foo'bar`},

{in: `"foo` + "\n", out: `foo`, err: "bad string"}, // newline in string
{in: `"foo`, out: `foo`, err: "bad string"}, // unclosed quotes
Expand Down

0 comments on commit 96938e8

Please sign in to comment.