fix: 账号备份选择SFTP有多个时,重复编码password会导致任务异常

This commit is contained in:
jiangweidong
2024-02-29 15:58:52 +08:00
committed by Bryan
parent 457d2b2359
commit b557e264bc
3 changed files with 4 additions and 5 deletions

View File

@@ -230,9 +230,8 @@ class ChangeSecretManager(AccountBasePlaybookManager):
for user in recipients:
attachments = []
if user.secret_key:
password = user.secret_key.encode('utf8')
attachment = os.path.join(path, f'{name}-{local_now_filename()}-{time.time()}.zip')
encrypt_and_compress_zip_file(attachment, password, [filename])
encrypt_and_compress_zip_file(attachment, user.secret_key, [filename])
attachments = [attachment]
ChangeSecretExecutionTaskMsg(name, user, summary).publish(attachments)
os.remove(filename)