-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Description:
I encountered an issue with listing files and directories when using a UNC path in the tinyfilemanager.php
file of the Tiny File Manager. The current implementation at line 1326, which uses scandir
, does not support UNC paths effectively. This results in the inability to list files and directories located on network shares.
$objects = is_readable($path) ? scandir($path) : array();
Proposed Improvement:
To address this issue, I suggest modifying the code from lines 1328 to 1340 to use a combination of opendir
and readdir
, which are more compatible with UNC paths. This approach has been tested and successfully lists files and directories from a UNC path.
Steps to Reproduce:
- Set
$root_path
to a UNC path, e.g.,\\\\10.0.10.10\\Data
. - Attempt to list files and directories using the current implementation.
- Observe that files and directories are not listed.
Proposed Code Change:
$objects = [];
if (is_dir($path)) {
if ($dh = opendir($path)) {
while (($file = readdir($dh)) !== false) {
if ($file !== '.' && $file !== '..') {
$objects[] = $file;
}
}
closedir($dh);
}
}
Benefits:
- Improved compatibility with network shares and UNC paths.
- Enhanced functionality for users accessing files on network drives.
I hope this suggestion helps improve the functionality of the Tiny File Manager. Please let me know if further details or testing are needed.