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.

CommentFileSizeAuthor
commons_search_js_encode.patch490 bytesjaperry
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jdanthinne’s picture

Status: Needs work » Postponed (maintainer needs more info)

Hi, 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.

Antti J. Salminen’s picture

Seems 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.

japerry’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

Guessing 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 ;-)

jdanthinne’s picture

Status: Reviewed & tested by the community » Fixed

Ok, pushed to dev.

  • Commit 0056fb3 on 7.x-1.x by jdanthinne:
    [#2012210] by japerry: Sanitize input in Javascript
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.