From 1e3f452d15e8f16d2ca6ec9e9903299f63e7b846 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 cea4b056..68fae434 100644 --- a/src/khoj/database/models/__init__.py +++ b/src/khoj/database/models/__init__.py @@ -639,7 +639,7 @@ def verify_public_conversation(sender, instance, **kwargs): # 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: