Fix Python 3.11 SyntaxError in AmneziaPeer.py

Python 3.11 raises 'f-string expression part cannot include a backslash'
on line 91, where strip('\n') sits inside an f-string {...}. PEP 701
lifted this restriction in 3.12.

Bind the decoded output to a local so the strip call happens outside
the f-string, which also removes the duplicate decode+strip already
performed on the preceding length check.

Closes #1289

Signed-off-by: Truffle <truffleagent@gmail.com>
pull/1290/head
Truffle 2026-05-31 09:07:58 +00:00
parent 71077880ad
commit 449ab22c87
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -87,8 +87,9 @@ class AmneziaPeer(Peer):
if psk_exist: os.remove(uid)
if len(updateAllowedIp.decode().strip("\n")) != 0:
current_app.logger.error(f"Update peer failed when updating Allowed IPs.\nInput: {newAllowedIPs}\nOutput: {updateAllowedIp.decode().strip('\n')}")
output = updateAllowedIp.decode().strip("\n")
if len(output) != 0:
current_app.logger.error(f"Update peer failed when updating Allowed IPs.\nInput: {newAllowedIPs}\nOutput: {output}")
return False, "Internal server error"
command = [f"{self.configuration.Protocol}-quick", "save", self.configuration.Name]