Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.3.0
-
None
-
-
d0794c43f21a, 382cbd618fe4f5
Description
Native filedialogs on Qt/Mac are not properly filtering out bundles when searching for files.
This can be reproduced with the standarddialogs example
1) Start the "Standard Dialogs"
2) Click QFileDialog::getOpenFileName() (or QFileDialog::getOpenFileNames()). This demo contains two filters,
"" and ".txt".
3) Choose the filter "*.txt"
4) Navigate to "/Library/Receipts" directory on the startup disk.
This contains the ".pkg" bundle receipts for all installed packages.
Result: .pkg bundles can be selected in the file chooser.
Expected: The "*.txt" filter being applied should prevent the user
from selecting bundles with a ".pkg" extension.
The above filtering issue also seems to occur with XCode project
bundles (.xcodeproj), Automator workflows (.workflow), so it does not appear to be isolated to Installer packages & receipts. It does not seem to occur with most application bundles, however.
Note that this actually is a Qt bug because the files are filtered by a Qt call back function (qt_mac_nav_filter)
This filter is passing through all folders without checking if they are bundles and has an explicit guard against application bundles in the final return statement of the function. The folder check should be extended with a check for directories that are really bundles and, if it is a bundle, apply the pattern matching rules to the name of the bundle.
It should also use the PATH_MAX define for the str_buffer variable...1024 does happen to match the value of PATH_MAX right now for the longest potential POSIX path, but that could change in the future.