QMimeType: remove unwanted *.bin as preferredSuffix for octet-stream

This leads to an automatically appended .bin when saving a file.

https://bugs.freedesktop.org/show_bug.cgi?id=101667
https://bugs.kde.org/382437

Fixed upstream in shared-mime-info 1.10

Change-Id: I125a0bc72c91a082706bf2bf149adcf63ff1ec6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
David Faure 2018-01-28 10:53:02 +01:00
parent 08559d2b77
commit 2b7de16fbe
2 changed files with 3 additions and 0 deletions

View File

@ -466,6 +466,8 @@ QStringList QMimeType::suffixes() const
*/
QString QMimeType::preferredSuffix() const
{
if (isDefault()) // workaround for unwanted *.bin suffix for octet-stream, https://bugs.freedesktop.org/show_bug.cgi?id=101667, fixed upstream in 1.10
return QString();
const QStringList suffixList = suffixes();
return suffixList.isEmpty() ? QString() : suffixList.at(0);
}

View File

@ -635,6 +635,7 @@ void tst_QMimeDatabase::suffixes_data()
QTest::newRow("mimetype with multiple patterns") << "text/plain" << "*.asc;*.txt;*,v" << "txt";
QTest::newRow("mimetype with uncommon pattern") << "text/x-readme" << "README*" << QString();
QTest::newRow("mimetype with no patterns") << "application/x-ole-storage" << QString() << QString();
QTest::newRow("default_mimetype") << "application/octet-stream" << "*.bin" << QString();
}
void tst_QMimeDatabase::suffixes()