The “Search in Folder” menu option (right-click on a folder in your tree view) is a handy way to put a specific directory into the path-pattern field of a project search panel.
But glob syntax is valid input for that field; so if the path contains any characters that have special meaning in glob syntax, they must be escaped. @asiloisad specifically called out [] in #1435, but there are probably others.
We already do something similar with the Find and Replace: Use Selection as Find Pattern command; if the regex option is active in the find panel, we escape any special regex characters before filling the “find” search field.