Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/unfold/sites.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import copy
import hashlib
import time
from collections.abc import Callable
from http import HTTPStatus
Expand All @@ -12,9 +13,9 @@
from django.http import HttpRequest, HttpResponse
from django.template.response import TemplateResponse
from django.urls import URLPattern, path, reverse, reverse_lazy
from django.utils.encoding import force_bytes
from django.utils.functional import lazy
from django.utils.module_loading import import_string
from django.utils.text import slugify

from unfold.dataclasses import DropdownItem, Favicon, SearchResult

Expand Down Expand Up @@ -284,7 +285,10 @@ def search(
return HttpResponse()

search_term = search_term.lower()
cache_key = f"unfold_search_{request.user.pk}_{slugify(search_term)}"
search_key_base = f"{request.user.pk}_{search_term}"
cache_key = (
f"unfold_search_{hashlib.sha256(force_bytes(search_key_base)).hexdigest()}"
)
cache_results = cache.get(cache_key)

if extended_search:
Expand Down