mirror of
https://github.com/prasathmani/tinyfilemanager.git
synced 2026-04-26 10:55:56 +03:00
[GH-ISSUE #1325] Advanced Search not working for read-only users #845
Labels
No labels
Feature
Feature
Is It Really an Issue?
Need More Info
Request
Security
bug
duplicate
enhancement
enhancement
help wanted
invalid
pull-request
question
suggestion
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tinyfilemanager#845
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @leonardooyama on GitHub (Jun 10, 2025).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/1325
When I am logged as read-only user, the Advanced Search doesn't return the expected results.
For admin users, the Advanced Search works correctly. I am using the latest version (2.6). Any hints?
@prasathmani commented on GitHub (Jun 11, 2025):
appreciate the report of the issue and will fix it in a future release.
@leonardooyama commented on GitHub (Jun 13, 2025):
Hi! If possible, I would like to contribute, but I couldn't find the error in the code. Do you have any idea where is it?
@smalos commented on GitHub (Jun 19, 2025):
I asked copilot:
Why Advanced Search Doesn't Work for Read-Only Users in TinyFileManager
Problem Description
For 3+ characters, the search returns nothing (no files, no "No result found", just blank).
Technical Cause
In
tinyfilemanager.php(v2.6), the PHP backend only processes the Advanced Search request if the user is NOT a read-only user.Relevant code excerpt:
The !FM_READONLY part means:
Read-only users cannot access this code block.
As a result, when a read-only user submits a search, the server returns nothing, leading to a blank result in the frontend.
Why Is This By Design?
Security: Advanced Search recursively lists all file/folder names. The authors restricted this for read-only users, possibly to prevent information leakage or heavy resource use.
Consistency: Most actions are limited for read-only users to keep the permission model simple and secure.
How to Enable Advanced Search for Read-Only Users
If you want read-only users to have access to Advanced Search, you’ll need to modify the code:
Steps:
Open tinyfilemanager.php in your editor.
Find this line:
&& !FM_READONLYRemove && !FM_READONLY so the condition becomes:
Save and upload the file.
Now, read-only users will also be able to use Advanced Search.
Security Note:
This change allows all authenticated users (including read-only) to recursively search for files and folders.
Make sure this is acceptable for your use case before deploying.
@ValerioLyndon commented on GitHub (Nov 12, 2025):
I was wondering why this issue was happening and thanks to smalos's comment it was a quick fix. Only change I made was an extra if() check to prevent affecting other code, because without reading the rest of the codebase I have to assume this check is in place to prevent the other AJAX features (such as file uploads) from being used by a conniving readonly user.
This way the only part affected should be the search.
Difference visible in this commit.