[scripts/copy-crosscode-emoji-url] change the order of URL params

This commit is contained in:
Dmytro Meleshko 2021-01-18 11:18:34 +02:00
parent f84dbb619c
commit f62df4016d

View file

@ -68,15 +68,15 @@ chosen_emote = emotes[chosen_index]
emote_url = urllib.parse.urlparse(chosen_emote["url"]) emote_url = urllib.parse.urlparse(chosen_emote["url"])
emote_url_query = urllib.parse.parse_qs(emote_url.query) emote_url_query = urllib.parse.parse_qs(emote_url.query)
if config.getboolean("default", "add_emote_name_to_url", fallback=False):
emote_url_query["name"] = [chosen_emote["name"]]
default_emote_image_size = config.getint( default_emote_image_size = config.getint(
"default", "default_emote_image_size", fallback=None "default", "default_emote_image_size", fallback=None
) )
if default_emote_image_size is not None: if default_emote_image_size is not None:
emote_url_query["size"] = [str(default_emote_image_size)] emote_url_query["size"] = [str(default_emote_image_size)]
if config.getboolean("default", "add_emote_name_to_url", fallback=False):
emote_url_query["name"] = [chosen_emote["name"]]
emote_url_query = urllib.parse.urlencode(emote_url_query, doseq=True) emote_url_query = urllib.parse.urlencode(emote_url_query, doseq=True)
emote_url = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query)) emote_url = urllib.parse.urlunparse(emote_url._replace(query=emote_url_query))