From afe88435094fbb1aa179baab5e2e16249258851a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 16 May 2018 10:26:47 +0200 Subject: Dive pictures: don't attempt reading the same image twice If loading of an image failed, we tried to see if we find a canonical filename in the cache. There's no point in rereading the picture if the canonical and the original filename are the same. Signed-off-by: Berthold Stoeger --- core/imagedownloader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/imagedownloader.cpp b/core/imagedownloader.cpp index 372f5318a..faa0d7ff7 100644 --- a/core/imagedownloader.cpp +++ b/core/imagedownloader.cpp @@ -115,7 +115,6 @@ static std::pair getHashedImage(const QString &file_in, bool tryDow hashPicture(file); } else if (tryDownload) { // This did not load anything. Let's try to get the image from other sources - // Let's try to load it locally via its hash QString filenameLocal = localFilePath(qPrintable(file)); qDebug() << QStringLiteral("Translated filename: %1 -> %2").arg(file, filenameLocal); if (filenameLocal.isNull()) { @@ -125,8 +124,9 @@ static std::pair getHashedImage(const QString &file_in, bool tryDow loadPicture(file, true); stillLoading = true; } else { - // Load locally from translated file name - thumb = loadImage(filenameLocal); + // Load locally from translated file name if it is different + if (filenameLocal != file) + thumb = loadImage(filenameLocal); if (!thumb.isNull()) { // Make sure the hash still matches the image file hashPicture(filenameLocal); -- cgit v1.2.3-70-g09d2