From 16175137e50cb67b41cd60c0878f6c0d20909db9 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Tue, 16 Jan 2024 12:58:07 +0530 Subject: [PATCH] Decode URL encoded query string in chat API endpoint before processing --- src/khoj/routers/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/khoj/routers/api.py b/src/khoj/routers/api.py index 575f094c..4cf670fa 100644 --- a/src/khoj/routers/api.py +++ b/src/khoj/routers/api.py @@ -6,6 +6,7 @@ import os import time import uuid from typing import Any, Dict, List, Optional, Union +from urllib.parse import unquote from asgiref.sync import sync_to_async from fastapi import APIRouter, Depends, File, HTTPException, Request, UploadFile @@ -704,6 +705,7 @@ async def chat( rate_limiter_per_day=Depends(ApiUserRateLimiter(requests=10, subscribed_requests=600, window=60 * 60 * 24)), ) -> Response: user: KhojUser = request.user.object + q = unquote(q) await is_ready_to_chat(user) conversation_command = get_conversation_command(query=q, any_references=True)