LinqToQuerystring icon indicating copy to clipboard operation
LinqToQuerystring copied to clipboard

extra space in orderby crashes the query

Open xt0rted opened this issue 12 years ago • 3 comments

I'm not sure if this is a bug or just my sloppy code but the following query works with Microsoft's OData implementation but crashes when I switch over to LinqToQuerystring

/api/purchases?$orderby=PurchasedOn+desc,+Id+desc

The issue is due to the extra + in the orderby right after the comma. If I remove it the query runs successfully.

xt0rted avatar Jan 24 '14 10:01 xt0rted

I have been looking over the OData spec and it does seem that this should be allowed. How much of a problem is this for you at the moment? Ordinarily this would not top of the priority list right... do you have a way of trimming the parameters?

beyond-code-github avatar Feb 01 '14 09:02 beyond-code-github

I fixed the spots where this was an issue. I'm not sure if the extra spaces were deliberate or not but I'm guessing it was a side effect of late night coding that just happened to not crash anything at the time. It's easy enough to fix if it happens again.

xt0rted avatar Feb 01 '14 16:02 xt0rted

+1 This is easy to handle if you're creating the url's yourself, however I'm using the OQuery library to generate the url's and it inserts spaces in the query which causes exceptions.

In my case it generates: $filter=(%20substringof(%27thename%27,ParentFolderName) which fails. This succeeds: $filter=(substringof(%27thename%27,ParentFolderName)

ccoulson avatar Mar 04 '15 05:03 ccoulson