mirror of
				https://github.com/open-webui/open-webui
				synced 2025-06-26 18:26:48 +00:00 
			
		
		
		
	Fix formatting
This commit is contained in:
		
							parent
							
								
									7c1b004687
								
							
						
					
					
						commit
						e06ff17a70
					
				@ -199,19 +199,24 @@ async def list_files(user=Depends(get_verified_user), content: bool = Query(True
 | 
			
		||||
 | 
			
		||||
@router.get("/search", response_model=list[FileModelResponse])
 | 
			
		||||
async def search_files(
 | 
			
		||||
    filename: str = Query(..., description="Filename pattern to search for. Supports wildcards such as '*.pdf'"),
 | 
			
		||||
    filename: str = Query(
 | 
			
		||||
        ...,
 | 
			
		||||
        description="Filename pattern to search for. Supports wildcards such as '*.txt'"
 | 
			
		||||
    ),
 | 
			
		||||
    user=Depends(get_verified_user)
 | 
			
		||||
):
 | 
			
		||||
    # Retrieve files from cache
 | 
			
		||||
    files = get_all_files_for_user(user.id, user.role == "admin")
 | 
			
		||||
 | 
			
		||||
    # Get matching files
 | 
			
		||||
    matching_files = [file for file in files if fnmatch(file.filename.lower(), filename.lower())]
 | 
			
		||||
    matching_files = [
 | 
			
		||||
        file for file in files if fnmatch(file.filename.lower(), filename.lower())
 | 
			
		||||
    ]
 | 
			
		||||
    
 | 
			
		||||
    if not matching_files:
 | 
			
		||||
        raise HTTPException(
 | 
			
		||||
            status_code=status.HTTP_404_NOT_FOUND,
 | 
			
		||||
            detail="No files found matching the pattern."
 | 
			
		||||
            detail="No files found matching the pattern.",
 | 
			
		||||
        )
 | 
			
		||||
    return matching_files
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user