Skip to content

Commit c5b9c00

Browse files
committed
fix
1 parent 644537b commit c5b9c00

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pywxdump/api/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ async def index():
7373
async def serve_file(filename: str):
7474
# 构建完整的文件路径
7575
file_path = os.path.join(web_path, filename)
76+
file_path = os.path.abspath(file_path)
7677

7778
# 检查文件是否存在
7879
if os.path.isfile(file_path):
@@ -81,6 +82,7 @@ async def serve_file(filename: str):
8182
# 如果 MIME 类型为空,则默认为 application/octet-stream
8283
if mime_type is None:
8384
mime_type = "application/octet-stream"
85+
server_loger.info(f"[+] 无法获取文件 MIME 类型,使用默认值:{mime_type}")
8486

8587
# 返回文件
8688
return FileResponse(file_path, media_type=mime_type)

0 commit comments

Comments
 (0)