mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-18 20:27:58 +00:00
fixed vulenerability in wipe_database endpoint
This commit is contained in:
parent
5f0b0341be
commit
7433f80d2c
@ -136,6 +136,7 @@ async def search(query: RAGQuery):
|
|||||||
@router.delete("/wipe_database", response_model=DocumentResponse)
|
@router.delete("/wipe_database", response_model=DocumentResponse)
|
||||||
async def wipe_database(key: str):
|
async def wipe_database(key: str):
|
||||||
await validate_key(key)
|
await validate_key(key)
|
||||||
|
key = sanitize_path(key)
|
||||||
user_folder = lollmsElfServer.lollms_paths / str(key)
|
user_folder = lollmsElfServer.lollms_paths / str(key)
|
||||||
shutil.rmtree(user_folder, ignore_errors=True)
|
shutil.rmtree(user_folder, ignore_errors=True)
|
||||||
return DocumentResponse(success=True, message="Database wiped successfully.")
|
return DocumentResponse(success=True, message="Database wiped successfully.")
|
||||||
|
Loading…
Reference in New Issue
Block a user