Skip to content

Commit c144aa9

Browse files
committed
Handle automation calling url of both url and string type
Calling url can be of url type in production but locally it is of string type. Unclear why. But this change should mitigate the issue for now.
1 parent fad6a63 commit c144aa9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/khoj/routers/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,7 +2174,7 @@ def scheduled_chat(
21742174
scheduling_request: str,
21752175
subject: str,
21762176
user: KhojUser,
2177-
calling_url: str,
2177+
calling_url: str | URL,
21782178
job_id: str = None,
21792179
conversation_id: str = None,
21802180
):
@@ -2194,8 +2194,8 @@ def scheduled_chat(
21942194
return
21952195

21962196
# Extract relevant params from the original URL
2197-
parsed_url = urlparse(calling_url)
2198-
scheme = parsed_url.scheme
2197+
parsed_url = URL(calling_url) if isinstance(calling_url, str) else calling_url
2198+
scheme = "http" if not parsed_url.is_secure else "https"
21992199
query_dict = parse_qs(parsed_url.query)
22002200

22012201
# Pop the stream value from query_dict if it exists

0 commit comments

Comments
 (0)