Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-3077

Javascript translator incorrectly handle quotes, null and undefined values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 3.6.7, 3.7.2
    • 3.6.8, 3.7.3
    • javascript
    • None

    Description

      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.

      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);

       

      output:

      g.addV('test').property('empty', 'null')
      g.addV('test').property('empty', )
      g.addV('test').property('quotes', 'some "quotes' in the middle.')
      

      which results in a server error when submitting translated query.

      Attachments

        Activity

          People

            colegreer Cole Greer
            valentyn Valentyn Kahamlyk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: