changeset 2913:bfffaa9aff58 beta

#589 search urlgenerator didn't properly escape special chars on url
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 09 Oct 2012 19:39:26 +0200
parents 976e2b032650
children 1cd1cbe6cdcc
files rhodecode/controllers/search.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/search.py	Tue Oct 09 19:26:30 2012 +0200
+++ b/rhodecode/controllers/search.py	Tue Oct 09 19:39:26 2012 +0200
@@ -24,7 +24,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 import logging
 import traceback
-
+import urllib
 from pylons.i18n.translation import _
 from pylons import request, config, tmpl_context as c
 
@@ -42,6 +42,7 @@
 from rhodecode.model.repo import RepoModel
 from rhodecode.lib.utils2 import safe_str, safe_int
 
+
 log = logging.getLogger(__name__)
 
 
@@ -116,8 +117,9 @@
                     )
 
                     def url_generator(**kw):
+                        q = urllib.quote(safe_str(c.cur_query))
                         return update_params("?q=%s&type=%s" \
-                        % (safe_str(c.cur_query), safe_str(c.cur_type)), **kw)
+                        % (q, safe_str(c.cur_type)), **kw)
                     repo_location = RepoModel().repos_path
                     c.formated_results = Page(
                         WhooshResultWrapper(search_type, searcher, matcher,