diff --git a/src/common/connection.py b/src/common/connection.py index 962b01d40..7435cdf64 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -324,8 +324,10 @@ class Connection: # Save it to file self.save_vcard_to_hd(who, card) # Save the decoded avatar to a separate file too, and generate files for dbus notifications + puny_jid = punycode_encode(frm) if photo_decoded: - avatar_file = os.path.join(gajim.AVATAR_PATH, frm + '_notif_size_colored.png') + avatar_file = os.path.join(gajim.AVATAR_PATH, + puny_jid + '_notif_size_colored.png') if frm == our_jid and avatar_sha != self.vcard_sha: gajim.interface.save_avatar_files(frm, photo_decoded) elif frm != our_jid and (not os.path.exists(avatar_file) or \ @@ -335,7 +337,7 @@ class Connection: else: for ext in ('.jpeg', '.png', '_notif_size_bw.png', '_notif_size_colored.png'): - path = os.path.join(gajim.AVATAR_PATH, frm + ext) + path = os.path.join(gajim.AVATAR_PATH, puny_jid + ext) if os.path.isfile(path): os.remove(path) diff --git a/src/gajim.py b/src/gajim.py index 21110b979..a9dd5c13a 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -99,6 +99,7 @@ import signal import getopt import time import threading +from encodings.punycode import punycode_encode import gtkgui_helpers import notify @@ -964,7 +965,8 @@ class Interface: def save_avatar_files(self, jid, photo_decoded): '''Save the decoded avatar to a separate file, and generate files for dbus notifications''' - path_to_file = os.path.join(gajim.AVATAR_PATH, jid) + puny_jid = punycode_encode(jid) + path_to_file = os.path.join(gajim.AVATAR_PATH, puny_jid) # remove old avatars for typ in ('jpeg', 'png'): path_to_original_file = path_to_file + '.' + typ diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index bc840b641..de0aa150c 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -491,7 +491,8 @@ def get_path_to_generic_or_avatar(generic, jid = None, suffix = None): Returns full path to the avatar image if it exists, otherwise returns full path to the image.''' if jid: - path_to_file = os.path.join(gajim.AVATAR_PATH, jid) + suffix + puny_jid = punycode_encode(jid) + path_to_file = os.path.join(gajim.AVATAR_PATH, puny_jid) + suffix if os.path.exists(path_to_file): return path_to_file return os.path.abspath(generic) diff --git a/src/tooltips.py b/src/tooltips.py index bd57cd976..81eb5bb51 100644 --- a/src/tooltips.py +++ b/src/tooltips.py @@ -29,6 +29,7 @@ import gobject import os import time import locale +from encodings.punycode import punycode_encode import gtkgui_helpers import message_control @@ -518,7 +519,8 @@ class RosterTooltip(NotificationAreaTooltip): info += '\n%s' % text for type_ in ('jpeg', 'png'): - file = os.path.join(gajim.AVATAR_PATH, prim_contact.jid + '.' + type_) + puny_jid = punycode_encode(prim_contact.jid) + file = os.path.join(gajim.AVATAR_PATH, puny_jid + '.' + type_) if os.path.exists(file): self.avatar_image.set_from_file(file) pix = self.avatar_image.get_pixbuf()