Valentyn Kahamlyk created TINKERPOP-3077:
--------------------------------------------
Summary: Javascript translator incorrectly handle quotes, null and
undefined values
Key: TINKERPOP-3077
URL: https://issues.apache.org/jira/browse/TINKERPOP-3077
Project: TinkerPop
Issue Type: Improvement
Components: javascript
Affects Versions: 3.7.2, 3.6.7
Reporter: Valentyn Kahamlyk
If there are `null` or `undefined` values in queries, the translator converts
them incorrectly. `null` converted as string "null" and `undefined` is simply
skipped.
Quotes are not properly escaped
Simple reproducer.
{code:javascript}
const script1 = new Translator('g')
.translate(g.addV('test').property('empty', null).getBytecode());
console.log(script1);
const script2 = new Translator('g')
.translate(g.addV('test').property('empty', undefined).getBytecode());
console.log(script2);
const script3 = new Translator('g')
.translate(g.addV('test').property('quotes', "some \"quotes' in the
middle.").getBytecode());
console.log(script3);{code}
output:
{code:java}
g.addV('test').property('empty', 'null')
g.addV('test').property('empty', )
g.addV('test').property('quotes', 'some "quotes' in the middle.')
{code}
which results in a server error when submitting translated query.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)