Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
77b1edcd
Commit
77b1edcd
authored
Apr 01, 2024
by
Timothy J. Baek
Browse files
fix: allowed hosts
parent
edeff20e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
backend/apps/ollama/main.py
backend/apps/ollama/main.py
+7
-0
No files found.
backend/apps/ollama/main.py
View file @
77b1edcd
...
...
@@ -970,6 +970,13 @@ def parse_huggingface_url(hf_url):
async
def
download_file_stream
(
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
if
os
.
path
.
exists
(
file_path
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment