Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

emoji: Use str.rjust to pad codepoint strings instead of a loop.

Puneeth Chaganti6beb84b55346
diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.py
index 130134246b7..611cb2b157d 100644
--- a/zerver/lib/markdown/__init__.py
+++ b/zerver/lib/markdown/__init__.py
@@ -1475,11 +1475,8 @@ def make_realm_emoji(src: str, display_string: str) -> Element:
def unicode_emoji_to_codepoint(unicode_emoji: str) -> str:
codepoint = hex(ord(unicode_emoji))[2:]
- # Unicode codepoints are minimum of length 4, padded
- # with zeroes if the length is less than four.
- while len(codepoint) < 4:
- codepoint = "0" + codepoint
- return codepoint
+ # Unicode codepoints are minimum of length 4, padded with zeroes
+ return codepoint.rjust(4, "0")
class EmoticonTranslation(markdown.inlinepatterns.Pattern):