Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filters with backslashes get double escaped #74

Open
jrust opened this issue Mar 9, 2011 · 3 comments
Open

Filters with backslashes get double escaped #74

jrust opened this issue Mar 9, 2011 · 3 comments

Comments

@jrust
Copy link

jrust commented Mar 9, 2011

Trying to create a filter like the following which needs to escape the question mark since it is a reserved character in regular expressions. Filter is:
:page_path.contains => '^/search?'

The string that should be sent to Google Analytics is:
filters=ga:pagePath%3D~%5E%2Fsearch%5C%3F

However, to_params escapes the backslash so that this is sent:
filters=ga:pagePath%3D~%5E%2Fsearch%5C%5C%3F

Not sure why to_params escapes backslashes, but at least in this case it's making it impossible to escape the question mark.

@jrust
Copy link
Author

jrust commented Mar 9, 2011

I did see on the filters API page that it says backslashes have to be escaped if you want to be able to search for a literal backslash. I would think, though, that the user creating the filter should escape a backslash so that the backslash can also be used to escape regexp characters.

@ghost ghost assigned tpitale Apr 10, 2011
@tpitale
Copy link
Contributor

tpitale commented Sep 16, 2011

Yes, I think that makes sense. I'll have to revisit this when I work on the new filtering again.

@bogdan
Copy link

bogdan commented Jul 25, 2012

Encountered the same problem. +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants