File Manager: error on advanced search Topics folder

Permalink 1 user found helpful
Hello,

I was fooling around with the file manager, and I wanted to search on a topic of the tree I created. The tree simply consists of the folder 'Categories' and the topics beneath it. (attachment: topiclist.jpg)
I assigned the complete topic tree as a file attribute. When I use the Advanced Search in the File Manager, I can select the created topics attribute as a filter value. The folder 'Categories' is selected by default. (attachment: filemanager-filter.jpg). When I instantly hit the 'Search'-button, while the folder is still selected, I get an error saying that a MySQL exception occurred: empty where clause. (attachment: error.jpg)

When I dug a bit deeper, I discovered that when you search in the File Manager on a folder or subfolder in a topic tree, the error always occurs. For my project, it was sufficient to create a quick solution that checks if the selected value of the topic tree is the root node. If so, the folder 'Categories' is selected instead of a topic beneath it. Then, I unset the filter value in the File Manager search request. Thus, the filter value will disappear when the page reloads.

This is the quick solution placed in \concrete\controllers\search\files.php on line 88
(Just before the loop through the filter fields)
if((isset($req['akID']) && count($req['akID']) > 0)) {
  foreach($req['akID'] as $ak_key => $ak_value) {
    $field = $ak_key;
    if(is_array($ak_value)) {
      if(array_key_exists('treeNodeID', $ak_value)) {
        $treeNodeID = $ak_value['treeNodeID'];
        $treeNode = Topic::getByID($treeNodeID);
        $tree = $treeNode->getTreeObject();
        $treeRootNodeID = $tree->getRootTreeNodeID();
        if($treeNodeID == $treeRootNodeID) {
          unset($req['akID'][$field]);
          if(!empty($req['field']) && count($req['field']) > 0) {
            if(($key = array_search($field, $req['field'])) !== false) {
              unset($req['field'][$key]);
            }


I use Concrete5.7.5.9. I also tested it in Concrete5.8.0.0, and the error still occurs.
When I create a website for someone, and the functionality of searching on a topic in the file manager is implemented, this error will most likely happen.

Any complete solutions for this issue?

Thanks,
Haxe93

3 Attachments

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi Haxe93,

I can confirm the error you described using concrete5 v8.02.

Have you checked the bug tracker to see if others are experiencing this issue? If no one has reported this issue, I recommend reporting it and including the steps required to repeat the error. Please reply back to this discussion if you create an issue, so I can upvote it.

concrete5 bug tracker
https://www.concrete5.org/developers/bugs...
wardhache2 replied on at Permalink Reply
I reported the issue in the bug tracker.
Here is the link:https://www.concrete5.org/developers/bugs/8-0-2/file-manager-error-o...

Thanks!