mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2026-06-06 10:16:18 +00:00
Fix Python 3.11 SyntaxError in AmneziaPeer.py (#1290)
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>
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user