Issue Bug Resolved

#110474File storage tree filter doesn't expand results when matches span multiple storages

Madalina Chis 08/13/26, 12:33 updated 10/09/26, 19:50

Description

When searching in the folder tree filter above File > Filelist, matching folders are not displayed if the search results span more than one file storage.
The tree stays fully collapsed even though the backend correctly returns matches.

This is a follow-on gap left by the fix for #106683, which added ‘loaded’ => true to matched-folder ancestor nodes in TreeController.php so intermediate
folders expand correctly within a single storage — but it didn’t address the top-level storage/mount node itself when a search result set contains more
than one storage.

Root cause:

In typo3/sysext/backend/Resources/Public/JavaScript/tree/tree.js, Tree.enhanceNodes() builds each node’s __expanded state. In search mode:
this.searchTerm ? i.__expanded = i.loaded && i.hasChildren : …
Storage/mount nodes (resourceType: “storage”, depth 0) always come back from the backend with loaded: false — this is correct/expected. To compensate,
there’s a single-root fallback at the end of enhanceNodes():
return t.filter(s => s.depth = 0).length = 1 && (t0.__expanded = true), t
This only force-expands the root when there is exactly one depth-0 node in the filtered result set. With two or more file storages configured (e.g. a
default fileadmin storage plus a second, permission-restricted storage), any search matching folders in more than one storage returns 2+ depth-0 nodes,
the === 1 check fails, and every root stays collapsed — hiding all matches underneath, even though the AJAX response
(/typo3/ajax/filestorage/tree/filterData) is correct.

Steps to reproduce:

1. Have at least two file storages configured (e.g. default fileadmin/ plus one additional mount), each containing folders that share a common search
term.
2. Go to File > Filelist.
3. Type a search term into the filter field above the folder tree that matches folders in more than one storage.
4. Observe: the storage root nodes stay collapsed and no results are shown, even though /typo3/ajax/filestorage/tree/filterData?q=<term> returns correct<br>matching data with proper parentIdentifier linkage.</term>

Suggested fix:

Generalize the single-root fallback to expand all depth-0 nodes while a search term is active, not just when there’s exactly one:
return this.searchTerm
? t.filter(s => s.depth = 0).forEach(s => { s.__expanded = true })
: t.filter(s => s.depth = 0).length === 1 && (t0.__expanded = true), t

Reviews 2

History 13

  1. Wouter Wolters commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-09T19:50:12+00:00" > 10/09/26, 19:50 </span>

    Applied in changeset commit:6d95237f6cf8b3887b4a619aa2abc7f728dd0224.