mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 21:42:58 +00:00
fix: allowed hosts
This commit is contained in:
parent
edeff20e1d
commit
77b1edcd0f
@ -970,6 +970,13 @@ def parse_huggingface_url(hf_url):
|
|||||||
async def download_file_stream(
|
async def download_file_stream(
|
||||||
ollama_url, file_url, file_path, file_name, chunk_size=1024 * 1024
|
ollama_url, file_url, file_path, file_name, chunk_size=1024 * 1024
|
||||||
):
|
):
|
||||||
|
allowed_hosts = ["https://huggingface.co/", "https://github.com/"]
|
||||||
|
|
||||||
|
if not any(file_url.startswith(host) for host in allowed_hosts):
|
||||||
|
raise ValueError(
|
||||||
|
"Invalid file_url. Only URLs from allowed hosts are permitted."
|
||||||
|
)
|
||||||
|
|
||||||
done = False
|
done = False
|
||||||
|
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
|
Loading…
Reference in New Issue
Block a user