mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-05 23:41:49 +00:00
better filename check
This commit is contained in:
parent
c4846e7e9d
commit
e5669daf67
9 changed files with 75 additions and 17 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from python.helpers.api import ApiHandler, Request, Response
|
||||
from python.helpers import files, memory
|
||||
import os
|
||||
from werkzeug.utils import secure_filename
|
||||
from python.helpers.security import safe_filename
|
||||
|
||||
|
||||
class ImportKnowledge(ApiHandler):
|
||||
|
|
@ -32,7 +32,9 @@ class ImportKnowledge(ApiHandler):
|
|||
|
||||
for file in file_list:
|
||||
if file and file.filename:
|
||||
filename = secure_filename(file.filename) # type: ignore
|
||||
filename = safe_filename(file.filename)
|
||||
if not filename:
|
||||
continue
|
||||
file.save(os.path.join(KNOWLEDGE_FOLDER, filename))
|
||||
saved_filenames.append(filename)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue