url_encoding: Skip unnecessary encode before quote.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-10-29 18:45:56 -07:00
committed by Tim Abbott
parent df10b306a6
commit 3c663e48db

View File

@@ -11,7 +11,7 @@ def hash_util_encode(string: str) -> str:
# frontend.
# `safe` has a default value of "/", but we want those encoded, too.
return urllib.parse.quote(
string.encode("utf-8"), safe=b"").replace(".", "%2E").replace("%", ".")
string, safe=b"").replace(".", "%2E").replace("%", ".")
def encode_stream(stream_id: int, stream_name: str) -> str:
# We encode streams for urls as something like 99-Verona.