Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Bug in $format Parsing #38

Open
alixaxel opened this issue Sep 29, 2016 · 1 comment · May be fixed by #41
Open

Bug in $format Parsing #38

alixaxel opened this issue Sep 29, 2016 · 1 comment · May be fixed by #41

Comments

@alixaxel
Copy link

alixaxel commented Sep 29, 2016

I noticed that if the $format parameter is present, it doesn't respect any potential following parameters:

console.log(oData.parse('$select=foo,bar&$top=10&$format=application/json&$skip=42'));

{
  '$select': [ 'foo', 'bar' ],
  '$top': 10,
  '$format': 'application/json&$skip=42'
}

Note how $skip is not parsed and is instead concatenated to $format.

However, if I move $skip to precede $format everything is parsed as expected:

console.log(oData.parse('$select=foo,bar&$top=10&$skip=42&$format=application/json'));

{
  '$select': [ 'foo', 'bar' ],
  '$top': 10,
  '$skip': 42,
  '$format': 'application/json'
}
@mkasberg
Copy link

Interesting. Definitely a bug with the grammar. It probably wouldn't be too hard to update the grammar so that "&" is recognized as not part of the $format string. Ideally, we'd limit that to a specific set of characters that are allowed in the format string. (odata.pegjs, near 221.)

@alixaxel alixaxel linked a pull request Oct 17, 2016 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants