"vscode:/vscode.git/clone" did not exist on "ce2b0c227c5fc1525bd7ca8d7b084b90f02cb62b"
Commit 947c392f authored by Mmx233's avatar Mmx233
Browse files

fix: manually check the docs' filename

parent 5558514f
......@@ -8,7 +8,7 @@ from fastapi import (
Form,
)
from fastapi.middleware.cors import CORSMiddleware
import os, shutil, logging
import os, shutil, logging, re
from pathlib import Path
from typing import List
......@@ -450,7 +450,7 @@ def store_doc(
try:
is_valid_filename = True
unsanitized_filename = file.filename
if not unsanitized_filename.isascii():
if re.search(r'[\\/:"\*\?<>|\n\t ]', unsanitized_filename) is not None:
is_valid_filename = False
unvalidated_file_path = f"{UPLOAD_DIR}/{unsanitized_filename}"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment