Review Request: KMimeTypeFactory: Fix handling of mixed case fast patterns
David Faure
faure at kde.org
Wed Jun 30 11:16:14 BST 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/4442/#review6326
-----------------------------------------------------------
Looks good, but can you add a unittest in kdelibs/kdecore/tests/kmimetypetest.cpp? Thanks.
(Probably by adding a line in KMimeTypeTest::testFindByPathUsingFileName_data)
Of course you have to pick a mimetype that is defined by freedesktop.org (or kde), I think EZHex isn't?
- David
On 2010-06-23 05:34:33, Anssi Hannula wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/4442/
> -----------------------------------------------------------
>
> (Updated 2010-06-23 05:34:33)
>
>
> Review request for kdelibs.
>
>
> Summary
> -------
>
> A mimetype glob is put into the "fast pattern" list when its weight is 50, it is in simple "*.foo" format, and it is case-insensitive (KBuildMimeTypeFactory::savePatternLists()). The pattern is lowercased when put into the fast pattern list. When MimeTypeFactory::findFromFastPatternDict() finds a match for a file extension, it checks the returned mimetype to make sure its patterns() list contains the searched pattern. However, the patterns() list contains the patterns in their original format, which may contain mixed case characters, therefore failing the test and the correct mimetype is not returned.
>
> Fix that by adding Qt::CaseInsensitive to the .contains() call.
>
> The two other pattern lists (low weight patterns and high weight patterns) are not affected as KMimeTypeFactory::findFromOtherPatternList() doesn't recheck the patterns() list of the returned mimetype.
>
> This bug affects 4.4 branch as well.
>
>
> Diffs
> -----
>
> /trunk/KDE/kdelibs/kdecore/services/kmimetypefactory.cpp 1141627
>
> Diff: http://reviewboard.kde.org/r/4442/diff
>
>
> Testing
> -------
>
> "kde-open file.EZHex", while the MIME type was defined with a glob "*.EZHex" (from libconcord/congruity).
> Before the patch it was opened in a web browser (*.EZHex files are XML based data), after the patch it is opened in the correct application associated with "*.EZHex".
> Testing was done on a KDE 4.4 system, but the relevant code seems to be the same in trunk.
>
>
> Thanks,
>
> Anssi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100630/19209648/attachment.htm>
More information about the kde-core-devel
mailing list