File tree 1 file changed +4
-4
lines changed
src/khoj/database/adapters
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1839,8 +1839,8 @@ def get_automations_metadata(user: KhojUser):
1839
1839
@staticmethod
1840
1840
def get_automation (user : KhojUser , automation_id : str ) -> Job :
1841
1841
# Perform validation checks
1842
- # Check if user is allowed to delete this automation id
1843
- if not is_none_or_empty (automation_id ) or automation_id .startswith (f"automation_{ user .uuid } _" ):
1842
+ # Check if user is allowed to retrieve this automation id
1843
+ if is_none_or_empty (automation_id ) or not automation_id .startswith (f"automation_{ user .uuid } _" ):
1844
1844
raise ValueError ("Invalid automation id" )
1845
1845
# Check if automation with this id exist
1846
1846
automation : Job = state .scheduler .get_job (job_id = automation_id )
@@ -1852,8 +1852,8 @@ def get_automation(user: KhojUser, automation_id: str) -> Job:
1852
1852
@staticmethod
1853
1853
async def aget_automation (user : KhojUser , automation_id : str ) -> Job :
1854
1854
# Perform validation checks
1855
- # Check if user is allowed to delete this automation id
1856
- if not automation_id .startswith (f"automation_{ user .uuid } _" ):
1855
+ # Check if user is allowed to retrieve this automation id
1856
+ if is_none_or_empty ( automation_id ) or not automation_id .startswith (f"automation_{ user .uuid } _" ):
1857
1857
raise ValueError ("Invalid automation id" )
1858
1858
# Check if automation with this id exist
1859
1859
automation : Job = await sync_to_async (state .scheduler .get_job )(job_id = automation_id )
You can’t perform that action at this time.
0 commit comments