mirror of https://github.com/zulip/zulip.git
mypy: Rewrite sign_is_valid in zthumbor helpers.py for None secret_key.
This commit is contained in:
parent
8b697b4093
commit
3b28d6ab8b
3
mypy.ini
3
mypy.ini
|
@ -89,9 +89,6 @@ strict_optional = False
|
|||
[mypy-zilencer.management.commands.add_new_realm] #22: error: List item 0 has incompatible type "Optional[Stream]"; expected "Stream"
|
||||
strict_optional = False
|
||||
|
||||
[mypy-zthumbor.loaders.helpers] #83: error: Argument 2 to "get_sign_hash" has incompatible type "Optional[str]"; expected "str"
|
||||
strict_optional = False
|
||||
|
||||
# Re-architecting required?
|
||||
|
||||
[mypy-zerver.lib.queue] # Delayed setup of SimpleQueueClient.channel (Optional)
|
||||
|
|
|
@ -80,6 +80,7 @@ def sign_is_valid(url, context):
|
|||
force_text(size),
|
||||
force_text(source_type),
|
||||
])
|
||||
if sign == get_sign_hash(raw, get_secret('thumbor_key')):
|
||||
return True
|
||||
return False
|
||||
secret_key = get_secret('thumbor_key')
|
||||
if secret_key is None or sign != get_sign_hash(raw, secret_key):
|
||||
return False
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue