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

@@ -21,6 +21,8 @@ def encrypt_and_compress_zip_file(filename, secret_password, encrypted_filenames
with pyzipper.AESZipFile(
filename, 'w', compression=pyzipper.ZIP_LZMA, encryption=pyzipper.WZ_AES
) as zf:
if secret_password and isinstance(secret_password, str):
secret_password = secret_password.encode('utf8')
zf.setpassword(secret_password)
for encrypted_filename in encrypted_filenames:
with open(encrypted_filename, 'rb') as f: