From da80d73f157935d752c2ca70b8ebb7314c1cd465 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 20 Jan 2012 09:45:54 +0530 Subject: [PATCH] Content server: Fix grouping for categories based on custom columns. Fixes #919011 (Server does not support _ in genre name) --- src/calibre/library/server/browse.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/calibre/library/server/browse.py b/src/calibre/library/server/browse.py index 6de6fad726..3314b1dab9 100644 --- a/src/calibre/library/server/browse.py +++ b/src/calibre/library/server/browse.py @@ -497,7 +497,8 @@ class BrowseServer(object): xml(s, True), xml(_('Loading, please wait'))+'…', unicode(c), - xml(u'/browse/category_group/%s/%s'%(category, + xml(u'/browse/category_group/%s/%s'%( + hexlify(category.encode('utf-8')), hexlify(s.encode('utf-8'))), True), self.opts.url_prefix) for s, c in category_groups.items()] @@ -531,6 +532,13 @@ class BrowseServer(object): sort = None if sort not in ('rating', 'name', 'popularity'): sort = 'name' + try: + category = unhexlify(category) + if isbytestring(category): + category = category.decode('utf-8') + except: + raise cherrypy.HTTPError(404, 'invalid category') + categories = self.categories_cache() if category not in categories: raise cherrypy.HTTPError(404, 'category not found')