Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-110707

Optimization in QMimeDatabasePrivate::mimeTypeForFile does not work for Custom File Engines

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.4.3, 6.5.0, 6.6.0
    • 6.4.1
    • Core: I/O
    • None
    • Linux/Wayland, Linux/X11, Linux/Yocto, Linux/Other display system, macOS
    • 40dd38813 (dev), 02a03f28f (6.4), 88689368d (6.5)

      https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/mimetypes/qmimedatabase.cpp#n446 introduced an optimisation to call QT_STAT directly instead of using QFileInfo on Q_OS_UNIX.

      This does not work for custom FileSystemEngines.

      When the QT_STAT returns != 0, it will then skip the initial check for if it is a directory and may try to open the path as a file and get its contents (which will fail for directories).

      In case the QT_STAT fails, a check using QFileInfo::isDir should still be done first to return directoryMimeType().

        For Gerrit Dashboard: QTBUG-110707
        # Subject Branch Project Status CR V

            thiago Thiago Macieira
            madwinter Marcus Tillmanns
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes