diff --git a/admin/dashboard/blueprints/message_push.py b/admin/dashboard/blueprints/message_push.py index fbc94f1..5862984 100644 --- a/admin/dashboard/blueprints/message_push.py +++ b/admin/dashboard/blueprints/message_push.py @@ -541,12 +541,10 @@ def upload_file(): file_type = 'video' if file and allowed_file(file.filename, file_type): - # 获取原始文件名和扩展名 - original_filename = secure_filename(file.filename) - file_ext = original_filename.rsplit('.', 1)[1].lower() - - # 生成唯一文件名,保持原始扩展名 - unique_filename = f"{uuid.uuid4().hex}.{file_ext}" + # 生成安全的文件名 + filename = secure_filename(file.filename) + # 生成唯一文件名 + unique_filename = f"{uuid.uuid4().hex}.{filename}" # 确保上传目录存在 upload_folder = os.path.join(current_app.root_path, 'static', 'uploads')