File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2592,17 +2592,15 @@ async def query_collection_handler(
25922592 )
25932593 elif collection_name .startswith ("file-" ):
25942594 file_id = collection_name [len ("file-" ) :]
2595- file = Files .get_file_by_id (file_id )
2596- if file and file .user_id != user .id :
2597- if not has_access_to_file (
2598- file_id = file_id ,
2599- access_type = "read" ,
2600- user = user ,
2601- ):
2602- raise HTTPException (
2603- status_code = status .HTTP_403_FORBIDDEN ,
2604- detail = ERROR_MESSAGES .ACCESS_PROHIBITED ,
2605- )
2595+ if not has_access_to_file (
2596+ file_id = file_id ,
2597+ access_type = "read" ,
2598+ user = user ,
2599+ ):
2600+ raise HTTPException (
2601+ status_code = status .HTTP_403_FORBIDDEN ,
2602+ detail = ERROR_MESSAGES .ACCESS_PROHIBITED ,
2603+ )
26062604
26072605 try :
26082606 if request .app .state .config .ENABLE_RAG_HYBRID_SEARCH and (
Original file line number Diff line number Diff line change @@ -804,7 +804,7 @@ async def __event_emitter__(event_data):
804804 Chats .add_message_status_to_chat_by_id_and_message_id ,
805805 request_info ["chat_id" ],
806806 request_info ["message_id" ],
807- status_data ,
807+ event_data . get ( "data" , {}) ,
808808 )
809809
810810 elif event_type == "message" :
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ def has_access_to_file(
3232 if not file :
3333 return False
3434
35+ # Direct ownership
36+ if file .user_id == user .id :
37+ return True
38+
3539 # Check if the file is associated with any knowledge bases the user has access to
3640 knowledge_bases = Knowledges .get_knowledges_by_file_id (file_id , db = db )
3741 user_group_ids = {
You can’t perform that action at this time.
0 commit comments