BrightcoveOS/.NET-MAPI-Wrapper

BrightcoveMapiWrapper.Api.BrightcoveApi.SearchVideos encodes values incorrectly

Closed this issue · 3 comments

Call stack:

Api.BrightcoveApi.SearchVideos
-> Api.BrightcoveApi.RunQuery
-> Api.Connectors.BrightcoveApiConnecter.GetResponseJson
-> Util.Extensions.CollectionExtensions.ToQueryString

In ToQueryString, each list of params in "all", "any", and "none" are split and encoded using HttpUtility.UrlEncode(s)

Looking at the query string generated from this, a parameter like "tag:tagname" gets encoded to "tag%3Atagname". Sending this query parameter to Brightcove results in no results.

Instead, if we use UrlPathEncode(s), we will correctly encode "tag:tagname" to "tag:tagname" and get results as expected.

I can make this change if that's okay, but not sure about what tests to run to verify it doesn't break any existing behaviour.

Thanks,
Bhaskar

Hi bhaskarmurthy,

Thanks for the bug report, but I'm not able to reproduce the issue you describe.

I tried running a tag search using the following code:

FieldValuePair searchTagPair = new FieldValuePair(); 
searchTagPair.Field = "tag"; 
searchTagPair.Value = "test";

_videos = _api.SearchVideos(new [] { searchTagPair }, null, null); 

The encoded request URL looks like this:

http://api.brightcove.com/services/library?command=search_videos&token=<my token>&media_delivery=http&get_item_count=true&exact=false&page_size=100&page_number=0&sort_by=CREATION_DATE&sort_order=ASC&all=tag%3atest

Notice that the colon is correctly URL encoded as "%3a".

This request functions correctly for me and returns video results from my account.

If you're still experiencing problems, could you provide the exact code you're using so I may replicate the issue?

Thanks,
Dave

Hmm. You're correct. Not sure what the issue was on my end, but using %3a seems to work just fine.
Sorry for the frivolous bug on this one!

No worries, I always appreciate when people take the time to report a bug :-)

Thanks!