Fix suggestion caching again for non-ASCII characters
This is why you should test this stuff with random input before rolling it out. Whoops. URL that caught this problem: /opensearch/packages/suggest?q=%D7%A0%D7%9F%D7%92%D7%9F aka /opensearch/packages/suggest?q=נןגן Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
86f8efaeb1
commit
d4c7a48623
@ -47,7 +47,8 @@ def opensearch_suggest(request):
|
||||
if search_term == '':
|
||||
return HttpResponse('', mimetype='application/x-suggestions+json')
|
||||
|
||||
cache_key = 'opensearch:packages:' + hashlib.md5(search_term).hexdigest()
|
||||
cache_key = 'opensearch:packages:' + \
|
||||
hashlib.md5(search_term.encode('utf-8')).hexdigest()
|
||||
to_json = cache.get(cache_key, None)
|
||||
if to_json is None:
|
||||
names = Package.objects.filter(
|
||||
|
Loading…
Reference in New Issue
Block a user