bug fix: do not allow prohibited characters in oc backups

This commit is contained in:
usmannasir
2024-10-19 17:08:17 +05:00
parent 501844b711
commit bfc2fc4c95

View File

@@ -1942,6 +1942,16 @@ class BackupManager:
try:
userName = user.userName.lower()
not_allowed_characters = [
' ', '/', '\\', '@', '!', '#', '$', '%', '^', '&', '*', '(', ')', '+', '=',
'{', '}', '[', ']', ':', ';', '"', "'", '<', '>', ',', '?', '|', '`', '~'
]
for items in not_allowed_characters:
userName = userName.replace(items, '')
backup_plan = OneClickBackups(
owner=user,
planName=plan_name,
@@ -1949,7 +1959,7 @@ class BackupManager:
price=price,
customer=customer,
subscription=subscription,
sftpUser=f'{user.userName}{str(randint(1000, 9999))}',
sftpUser=f'{userName}{str(randint(1000, 9999))}',
)
backup_plan.save()