From 1e8c15e2bd291888f5330771901ff58b4039d559 Mon Sep 17 00:00:00 2001 From: Andrea Di Menna Date: Mon, 3 Oct 2011 15:44:38 +0200 Subject: Improve the mechanism of thumnbs file names generation We are now using an md5 hash instead of base64 strings. Please, read review 102760 description about. REVIEW: 102760 REVIEWED-BY: adjam --- src/websnap.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/websnap.cpp') diff --git a/src/websnap.cpp b/src/websnap.cpp index d041156e..f8b57d70 100644 --- a/src/websnap.cpp +++ b/src/websnap.cpp @@ -40,6 +40,8 @@ #include #include +#include + #include #include @@ -138,7 +140,9 @@ QString WebSnap::imagePathFromUrl(const KUrl &url) QUrl temp = QUrl(url.url()); QByteArray name = temp.toEncoded(QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash); - return KStandardDirs::locateLocal("cache", QString("thumbs/") + name.toBase64() + ".png", true); + QByteArray hashedName = QCryptographicHash::hash(name, QCryptographicHash::Md5).toHex(); + + return KStandardDirs::locateLocal("cache", QString("thumbs/") + hashedName + ".png", true); } -- cgit v1.2.1