mirror of
https://github.com/koush/scrypted.git
synced 2026-06-20 16:40:30 +01:00
server/python: fix hash calculation (#1720)
This commit is contained in:
@@ -144,7 +144,11 @@ class ClusterSetup:
|
||||
m = hashlib.sha256()
|
||||
m.update(
|
||||
bytes(
|
||||
f"{o['id']}{o.get('address', '')}{o['port']}{o.get('sourceKey', '')}{o['proxyId']}{self.clusterSecret}",
|
||||
# The use of ` o.get(key, None) or '' ` is to ensure that optional fields
|
||||
# are omitted from the hash, matching the JS implementation. Otherwise, since
|
||||
# the dict may contain the keys initialized to None, ` o.get(key, '') ` would
|
||||
# return None instead of ''.
|
||||
f"{o['id']}{o.get('address', None) or ''}{o['port']}{o.get('sourceKey', None) or ''}{o['proxyId']}{self.clusterSecret}",
|
||||
"utf8",
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user