You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Brandon Peters <br...@gmail.com> on 2008/07/11 19:33:23 UTC

Problem with escapeString call on params in views.js

I was recently working on creating an app for my SNS, and had some
problems with transferring data between views using requestNavigateTo.
The data I am passing is a JSON encoded string representing an array
of arrays. When I fetched the data in my destination view using
gadgets.views.getParams(), the data would always be empty. I tracked
the problem down to line 77 in the features/views/views.js file. On
that line, gadgets.util.escapeString() is called on each parameter.
The problem with this is that I'm not just passing strings in, I'm
also passing in arrays. I changed the code to use
gadgets.util.escape() and it works great. I'm not sure if this is
correct, but it works for me. I've attached a patch, and here is the
summary:

params[p] = gadgets.util.escapeString(params[p]);

becomes

params[p] = gadgets.util.escape(params[p]);

Thanks,
Brandon


-- 
Brandon Peters

Re: Problem with escapeString call on params in views.js

Posted by Kevin Brown <et...@google.com>.
The spec says that requestNavigateTo takes a map of strings, not arbitrary
objects. To pass a piece of JSON data like this, you'll need to manually uri
encode it and pass it through.

On Fri, Jul 11, 2008 at 10:33 AM, Brandon Peters <br...@gmail.com>
wrote:

> I was recently working on creating an app for my SNS, and had some
> problems with transferring data between views using requestNavigateTo.
> The data I am passing is a JSON encoded string representing an array
> of arrays. When I fetched the data in my destination view using
> gadgets.views.getParams(), the data would always be empty. I tracked
> the problem down to line 77 in the features/views/views.js file. On
> that line, gadgets.util.escapeString() is called on each parameter.
> The problem with this is that I'm not just passing strings in, I'm
> also passing in arrays. I changed the code to use
> gadgets.util.escape() and it works great. I'm not sure if this is
> correct, but it works for me. I've attached a patch, and here is the
> summary:
>
> params[p] = gadgets.util.escapeString(params[p]);
>
> becomes
>
> params[p] = gadgets.util.escape(params[p]);
>
> Thanks,
> Brandon
>
>
> --
> Brandon Peters
>