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
d94bc21a
Unverified
Commit
d94bc21a
authored
Apr 03, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Apr 03, 2024
Browse files
Merge pull request #1408 from Mmx233/main
fix: manually check the docs' filename
parents
fa61e738
947c392f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
backend/apps/rag/main.py
backend/apps/rag/main.py
+2
-2
No files found.
backend/apps/rag/main.py
View file @
d94bc21a
...
@@ -8,7 +8,7 @@ from fastapi import (
...
@@ -8,7 +8,7 @@ from fastapi import (
Form
,
Form
,
)
)
from
fastapi.middleware.cors
import
CORSMiddleware
from
fastapi.middleware.cors
import
CORSMiddleware
import
os
,
shutil
,
logging
import
os
,
shutil
,
logging
,
re
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
List
from
typing
import
List
...
@@ -450,7 +450,7 @@ def store_doc(
...
@@ -450,7 +450,7 @@ def store_doc(
try
:
try
:
is_valid_filename
=
True
is_valid_filename
=
True
unsanitized_filename
=
file
.
filename
unsanitized_filename
=
file
.
filename
if
not
unsanitized_filename
.
isascii
()
:
if
re
.
search
(
r
'[\\/:"\*\?<>|\n\t ]'
,
unsanitized_filename
)
is
not
None
:
is_valid_filename
=
False
is_valid_filename
=
False
unvalidated_file_path
=
f
"
{
UPLOAD_DIR
}
/
{
unsanitized_filename
}
"
unvalidated_file_path
=
f
"
{
UPLOAD_DIR
}
/
{
unsanitized_filename
}
"
...
...
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