|
@@ -173,19 +173,21 @@ async def mergefile(identifier: str = Query(''),
|
|
|
async def download_file(
|
|
|
filename: str,
|
|
|
filenameDesc: str = None,
|
|
|
- user_id = Depends(valid_access_token)
|
|
|
+ # user_id = Depends(valid_access_token)
|
|
|
):
|
|
|
"""
|
|
|
根据提供的文件名下载文件。
|
|
|
:param filename: 要下载的文件的名称。
|
|
|
"""
|
|
|
try:
|
|
|
- if user_id == False:
|
|
|
- return JSONResponse(status_code=404, content={'code': 404, "msg": '警告:未登录禁止下载文件'})
|
|
|
- # 构造文件的完整路径
|
|
|
- if '../' in filename or '/' in filename:
|
|
|
- return JSONResponse(status_code=404, content={'code': 404, "msg": '警告:禁止跨路径下载文件'})
|
|
|
+ # if user_id == False:
|
|
|
+ # return JSONResponse(status_code=404, content={'code': 404, "msg": '警告:未登录禁止下载文件'})
|
|
|
+ # # 构造文件的完整路径
|
|
|
+ # if '../' in filename or '/' in filename:
|
|
|
+ # return JSONResponse(status_code=404, content={'code': 404, "msg": '警告:禁止跨路径下载文件'})
|
|
|
+
|
|
|
file_path = os.path.join(UPLOAD_mergefile_PATH, 'uploads/', filename)
|
|
|
+ print(file_path)
|
|
|
|
|
|
# 检查文件是否存在
|
|
|
if not os.path.isfile(file_path):
|