[ 
https://issues.apache.org/jira/browse/TINKERPOP-3077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17890237#comment-17890237
 ] 

Cole Greer commented on TINKERPOP-3077:
---------------------------------------

Fixed in CTR: 
https://github.com/apache/tinkerpop/commit/67a0d2769fe079fa345eac778bf112e69e251684

> 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: Bug
>          Components: javascript
>    Affects Versions: 3.6.7, 3.7.2
>            Reporter: Valentyn Kahamlyk
>            Priority: Blocker
>
> 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)

Reply via email to