bruns added a comment.
In D18915#416402 <https://phabricator.kde.org/D18915#416402>, @cfoster wrote: > In D18915#416400 <https://phabricator.kde.org/D18915#416400>, @bruns wrote: > > > https://doc.qt.io/qt-5/qmimedatabase.html#suffixForFileName > > > > > Returns the suffix for the file fileName, as known by the MIME database. > > > This allows to pre-select "tar.bz2" for foo.tar.bz2, but still only "txt" for my.file.with.dots.txt. > > > This was the original method of getting the file extension however it was converting the file extensions to lower case. > > This can be demonstrated with the following code: > QMimeDatabase db; > QUrl url = (QString) "foo.TXT"; > const QString extension = db.suffixForFileName(url.toDisplayString()); > qDebug(qUtf8Printable(extension)); //outputs "txt" Just compare the extension after `.toLower()`, and if both match, keep the original one. REPOSITORY R241 KIO REVISION DETAIL https://phabricator.kde.org/D18915 To: cfoster, #dolphin, #frameworks, abalaji Cc: bruns, ngraham, elvisangelaccio, chinmoyr, kde-frameworks-devel, michaelh