This commit is contained in:
xaoyaoo 2024-09-02 13:32:17 +08:00
parent 91b7aa34cb
commit e75465d93c

View File

@ -83,6 +83,8 @@ def gen_fastapi_app():
if mime_type is None:
mime_type = "application/octet-stream"
server_loger.info(f"[+] 无法获取文件 MIME 类型,使用默认值:{mime_type}")
if file_path.endswith(".js"):
mime_type = "text/javascript"
server_loger.info(f"[+] 文件 {file_path} MIME 类型:{mime_type}")
# 返回文件
return FileResponse(file_path, media_type=mime_type)