From kde-commits Wed Aug 18 18:40:45 2010 From: Teemu Rytilahti Date: Wed, 18 Aug 2010 18:40:45 +0000 To: kde-commits Subject: branches/KDE/4.5/kdenetwork/kopete/libkopete Message-Id: <20100818184045.EA5B4AC855 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=128215670406750 SVN commit 1165284 by rytilahti: backport r1156229: Use KIO::encodeFilename() before trying to save the user's avatar photo to the disk. This is needed because in XMPP the JID may contain a slash, which is reserved character in filesystem. CCBUGS:156184 M +4 -4 kopeteavatarmanager.cpp --- branches/KDE/4.5/kdenetwork/kopete/libkopete/kopeteavatarmanager.cpp #1165283:1165284 @@ -178,7 +178,7 @@ // for the contact avatar, save it with the contactId + .png if (newEntry.category == AvatarManager::Contact && newEntry.contact) { - avatarFilename = newEntry.contact->contactId() + ".png"; + avatarFilename = KIO::encodeFileName(newEntry.contact->contactId()) + ".png"; } else { @@ -199,7 +199,7 @@ if( !avatar.save( avatarUrl.toLocalFile(), "PNG") ) { - kDebug(14010) << "Saving of " << avatarUrl.toLocalFile() << " failed !"; + kDebug(14010) << "Saving of scaled avatar to " << avatarUrl.toLocalFile() << " failed !"; return AvatarEntry(); } @@ -208,7 +208,7 @@ // for the contact avatar, save it with the contactId + .png if (newEntry.category == AvatarManager::Contact && newEntry.contact) { - dataFilename = newEntry.contact->contactId() + QLatin1String("_"); + dataFilename = KIO::encodeFileName(newEntry.contact->contactId()) + QLatin1String("_"); } dataFilename += KMD5(data).hexDigest(); @@ -223,7 +223,7 @@ QFile f(dataUrl.toLocalFile()); if (!f.open(QIODevice::WriteOnly)) { - kDebug(14010) << "Saving of " << dataUrl.toLocalFile() << " failed !"; + kDebug(14010) << "Saving of original avatar to " << dataUrl.toLocalFile() << " failed !"; return AvatarEntry(); } f.write(data);