Ebeo / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Unable to query Google Analytics when using a Filter value of ga:pagePath=~^/maidstone/.*$ #378

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Querying the Analytics API using the AnalyticsService class
2. Using a filter value that contains the string 'ids'

What is the expected output? What do you see instead?
Instead of a normal response from I receive an exception due to a "(400) Bad 
Request." response from 
the server.

I've had a look at the .NET library and there is a bug in the AppendQueryPart 
method (line 903) of the 
FeedQuery class in the Core Client project. When adding a parameter to the 
querystring the code ensures 
this parameter hasn't already been added, but this check isn't working 
properly. For the ids parameter 
the querystring is checked to see if it contains the string "ids" - this string 
could be found in a 
parameter value and the check would return a false positive. 

Therefore I would recommend that all occurrences of the following code:

if (builder.ToString().IndexOf(parameterName) == -1)

are changed to the following:

if (builder.ToString().IndexOf(parameterName + "=") == -1)

It may just be neater to use an array of parameters that can be joined to make 
a string once all 
parameters have been added, instead of using the StringBuilder class.

Original issue reported on code.google.com by parish.a...@gmail.com on 28 Apr 2010 at 8:52

GoogleCodeExporter commented 9 years ago
changed per suggestion. When i rewrite this, yep, a map is in order.

Frank

Original comment by fman...@gmail.com on 26 May 2010 at 8:14