Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-249

'formatLiteral' function escapes only the first occurrence of a single quote instead of all of them

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • V2 1.1.0, V2 1.2.0
    • None
    • odata4-client-JS
    • None
    • All

    Description

      Handling of single quotes (‘) in the “formatLiteral” function (line 6879 in datajs-1.1.2.js) is broken if 'value' contains more than one occurrence. The relevant code is:

      var formatLiteral = function (value, type) {

      value = encodeURIComponent(value.replace("'", "''"));

      The problem is that value.replace("'", "''") replaces only the first occurrence of ', not all of them which is the intended behavior. The code should be:

      value = encodeURIComponent(value.replace(/'/g, "''"));

      Attachments

        1. Olingo-249.patch
          0.5 kB
          Daniel Molina

        Activity

          People

            bingl Bing Li
            Damolina Daniel Molina
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: