Skip to content

Commit

Permalink
Handle sharing old conversation publically even if they have no slug
Browse files Browse the repository at this point in the history
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
  • Loading branch information
debanjum committed Dec 18, 2024
1 parent ead98c4 commit 7fe591a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/khoj/database/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7fe591a

Please sign in to comment.