Summary: | a gallery with two images whose names differ only in the extension give two identical thumbnails | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Olivier Trichet <nive> |
Component: | kimgalleryplugin | Assignee: | Lukáš Tinkl <lukas> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ana |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | avoid thumbnails name clash |
Description
Olivier Trichet
2006-08-14 19:42:20 UTC
Created attachment 17373 [details]
avoid thumbnails name clash
With this patch, the original file extension is no longer trimed. So that, for
example, photo.jpg and photo.gif can have their thumbnail (respectively
photo.jpg.jpg and photo.gif.jpg), instead of sharing photo.jpg and thumbnail's
name.
SVN commit 620556 by mkoller: BUG: 132407 Don't trim filename extensions to avoid filename clash with two files having the same name but different filetypes (extension) Patch provided by Olivier Trichet M +3 -4 imgalleryplugin.cpp --- branches/KDE/3.5/kdeaddons/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp #620555:620556 @@ -202,8 +202,7 @@ if (createThumb(imgName, sourceDirName, imgGalleryDir, imageFormat)) { - const QString imgNameFormat = imgName.left(imgName.findRev('.',-1)); - const QString imgPath("thumbs/" + imgNameFormat + extension(imageFormat)); + const QString imgPath("thumbs/" + imgName + extension(imageFormat)); stream << "<img src=\"" << imgPath << "\" width=\"" << m_imgWidth << "\" "; stream << "height=\"" << m_imgHeight << "\" alt=\"" << imgPath << "\"/>"; m_progressDlg->setLabelText( i18n("Created thumbnail for: \n%1").arg(imgName) ); @@ -356,7 +355,7 @@ // ..all the thumbnails .. for (uint i=0; i < imageDir.count(); i++) { const QString imgName = imageDir[i]; - const QString imgNameFormat = imgName.left(imgName.findRev('.',-1)) + extension(imageFormat); + const QString imgNameFormat = imgName + extension(imageFormat); bool isRemoved = thumb_dir.remove(imgNameFormat); kdDebug(90170) << "removing: " << thumb_dir.path() << "/" << imgNameFormat << "; "<< isRemoved << endl; } @@ -435,7 +434,7 @@ KIO::NetAccess::copy(srcURL, destURL, static_cast<KParts::Part *>(parent())->widget()); } - const QString imgNameFormat = imgName.left( imgName.findRev('.',-1) ) + extension(imageFormat); + const QString imgNameFormat = imgName + extension(imageFormat); const QString thumbDir = imgGalleryDir + QString::fromLatin1("/thumbs/"); int extent = m_configDlg->getThumbnailSize(); |