You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Bing Li (JIRA)" <ji...@apache.org> on 2014/05/16 13:14:37 UTC

[jira] [Resolved] (OLINGO-249) 'formatLiteral' function escapes only the first occurrence of a single quote instead of all of them

     [ https://issues.apache.org/jira/browse/OLINGO-249?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bing Li resolved OLINGO-249.
----------------------------

    Resolution: Fixed

The fix has been checked in to Olingo-odata3-js.

> 'formatLiteral' function escapes only the first occurrence of a single quote instead of all of them
> ---------------------------------------------------------------------------------------------------
>
>                 Key: OLINGO-249
>                 URL: https://issues.apache.org/jira/browse/OLINGO-249
>             Project: Olingo
>          Issue Type: Bug
>          Components: datajs
>    Affects Versions: V2 1.1.0, V2 1.2.0
>         Environment: All
>            Reporter: Daniel Molina
>            Assignee: Bing Li
>         Attachments: Olingo-249.patch
>
>
> 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, "''")); 



--
This message was sent by Atlassian JIRA
(v6.2#6252)