mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
python: Convert percent formatting to Python 3.6 f-strings.
Generated by pyupgrade --py36-plus. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
6480deaf27
commit
67e7a3631d
@@ -8,7 +8,7 @@ def generate_camo_url(url: str) -> str:
|
||||
encoded_camo_key = settings.CAMO_KEY.encode("utf-8")
|
||||
digest = hmac.new(encoded_camo_key, encoded_url, hashlib.sha1).hexdigest()
|
||||
hex_encoded_url = binascii.b2a_hex(encoded_url)
|
||||
return "%s/%s" % (digest, hex_encoded_url.decode("utf-8"))
|
||||
return "{}/{}".format(digest, hex_encoded_url.decode("utf-8"))
|
||||
|
||||
# Encodes the provided URL using the same algorithm used by the camo
|
||||
# caching https image proxy
|
||||
@@ -16,7 +16,7 @@ def get_camo_url(url: str) -> str:
|
||||
# Only encode the url if Camo is enabled
|
||||
if settings.CAMO_URI == '':
|
||||
return url
|
||||
return "%s%s" % (settings.CAMO_URI, generate_camo_url(url))
|
||||
return f"{settings.CAMO_URI}{generate_camo_url(url)}"
|
||||
|
||||
def is_camo_url_valid(digest: str, url: str) -> bool:
|
||||
camo_url = generate_camo_url(url)
|
||||
|
||||
Reference in New Issue
Block a user