When I search for a user in commons, I try:
"Test User"
Which then throws a JS error:
"Uncaught Syntax error, unrecognized expression: User"]"
I believe this is because the JS is not sanitizing the input from lines 63-90. I've attached a patch that fixes it for us, by urlencoding the string, which sanitizes it for us. However, I'm not certain if this is the right approach for advanced searches with the custom search module, since I see code looking for 'type:' and splitting on spaces (which wouldn't work if we did the following).
It fixes our immediate issue, but something more comprehensive should be done.
Comment | File | Size | Author |
---|---|---|---|
commons_search_js_encode.patch | 490 bytes | japerry |
Comments
Comment #1
jdanthinne CreditAttribution: jdanthinne commentedHi, I've just installed the latest version of Commons (7.x-3.2), and tried to search for a user, but everything's fine, and I get no JS error.
Comment #2
Antti J. Salminen CreditAttribution: Antti J. Salminen commentedSeems like this is probably related to https://drupal.org/node/2118723
I suppose the fix in that issue may not be enough for cases where "type:" does exist in the search string.
Comment #3
japerryGuessing from #1, I'm going to say this is RTBC ;)
(Backlog: we committed this patch to the make file in commons, so when you downloaded it, it contained the patch and thus the issue doesn't occur anymore ;-)
Comment #4
jdanthinne CreditAttribution: jdanthinne commentedOk, pushed to dev.