From 7fe591a4737b76f1548647689bac84f996b0cf29 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Tue, 17 Dec 2024 19:40:44 -0800 Subject: [PATCH] Handle sharing old conversation publically even if they have no slug New conversation have a slug, but older conversation may not. This change allows those older conversations to still be shareable by using a random uuid for constructing their url instead --- src/khoj/database/models/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/khoj/database/models/__init__.py b/src/khoj/database/models/__init__.py index cea4b056a..68fae4345 100644 --- a/src/khoj/database/models/__init__.py +++ b/src/khoj/database/models/__init__.py @@ -639,7 +639,7 @@ def generate_random_alphanumeric(length): # check if this is a new instance if instance._state.adding: - slug = re.sub(r"\W+", "-", instance.slug.lower())[:50] + slug = re.sub(r"\W+", "-", instance.slug.lower())[:50] if instance.slug else uuid.uuid4().hex observed_random_id = set() while PublicConversation.objects.filter(slug=slug).exists(): try: